]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
iwlwifi: mvm: check if mac80211_queue is valid in iwl_mvm_disable_txq
authorLuca Coelho <luciano.coelho@intel.com>
Mon, 18 Dec 2017 18:13:07 +0000 (20:13 +0200)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Mon, 27 Aug 2018 14:40:05 +0000 (16:40 +0200)
commit5b41966bf174242824b201fba5aafbf97afad3d1
treea14e37ec34dc78dcdcee283e5f8e2c1915298f59
parentc5078266c1d8fcd1df79aa76bae32c05734c0623
iwlwifi: mvm: check if mac80211_queue is valid in iwl_mvm_disable_txq

BugLink: http://bugs.launchpad.net/bugs/1786352
[ Upstream commit 9a233bb8025105db9a60b5d761005cc5a6c77f3d ]

Sometimes iwl_mvm_disable_txq() may be called with mac80211_queue ==
IEEE80211_INVAL_HW_QUEUE, and this would cause us to use BIT(0xFF)
which is way too large for the u16 we used to store it in
hw_queue_to_mac820211.  If this happens the following UBSAN warning
will be generated:

[  167.185167] UBSAN: Undefined behaviour in drivers/net/wireless/intel/iwlwifi/mvm/utils.c:838:5
[  167.185171] shift exponent 255 is too large for 64-bit type 'long unsigned int'

Fix that by checking that it is not IEEE80211_INVAL_HW_QUEUE and,
while at it, add a warning if the queue number is larger than
IEEE80211_MAX_QUEUES.

Fixes: 34e10860ae8d ("iwlwifi: mvm: remove references to queue_info in new TX path")
Reported-by: Paul Menzel <pmenzel+linux-wireless@molgen.mpg.de>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/net/wireless/intel/iwlwifi/mvm/utils.c