linux/drivers/net/wireless
Brian Norris 0e720cd706 mwifiex: correct channel stat buffer overflows
commit 4b5dde2d62 upstream.

mwifiex records information about various channels as it receives scan
information. It does this by appending to a buffer that was sized
to the max number of supported channels on any band, but there are
numerous problems:

(a) scans can return info from more than one band (e.g., both 2.4 and 5
    GHz), so the determined "max" is not large enough
(b) some firmware appears to return multiple results for a given
    channel, so the max *really* isn't large enough
(c) there is no bounds checking when stashing these stats, so problems
    (a) and (b) can easily lead to buffer overflows

Let's patch this by setting a slightly-more-correct max (that accounts
for a combination of both 2.4G and 5G bands) and adding a bounds check
when writing to our statistics buffer.

Due to problem (b), we still might not properly report all known survey
information (e.g., with "iw <dev> survey dump"), since duplicate results
(or otherwise "larger than expected" results) will cause some
truncation. But that's a problem for a future bugfix.

(And because of this known deficiency, only log the excess at the WARN
level, since that isn't visible by default in this driver and would
otherwise be a bit too noisy.)

Fixes: bf35443314 ("mwifiex: channel statistics support for mwifiex")
Cc: Avinash Patil <patila@marvell.com>
Cc: Xinming Hu <huxm@marvell.com>
Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Ganapathi Bhat <gbhat@marvell.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2017-09-09 17:39:40 +02:00
..
admtek cfg80211: remove enum ieee80211_band 2016-04-12 15:56:15 +02:00
ath ath10k: fix memory leak in rx ring buffer allocation 2017-09-09 17:39:39 +02:00
atmel mac80211: Add support for beacon report radio measurement 2016-07-06 14:53:19 +02:00
broadcom brcmfmac: fix memleak due to calling brcmf_sdiod_sgtable_alloc() twice 2017-08-11 08:49:28 -07:00
cisco wireless: airo: rename 'register' variable 2016-06-29 18:56:20 +03:00
intel iwlwifi: pci: add new PCI ID for 7265D 2017-09-09 17:39:40 +02:00
intersil p54: memset(0) whole array 2017-09-02 07:07:53 +02:00
marvell mwifiex: correct channel stat buffer overflows 2017-09-09 17:39:40 +02:00
mediatek mt7601u: use linux/bitfield.h 2016-09-09 12:09:25 +03:00
ralink rt2x00: avoid introducing a USB dependency in the rt2x00lib module 2017-06-29 13:00:31 +02:00
realtek rtlwifi: rtl_pci_probe: Fix fail path of _rtl_pci_find_adapter 2017-09-09 17:39:40 +02:00
rsi rsi: eliminate superfluous NULL check 2016-06-14 17:17:58 +03:00
st mac80211: Add support for beacon report radio measurement 2016-07-06 14:53:19 +02:00
ti wl1251: add a missing spin_lock_init() 2017-09-07 08:35:40 +02:00
zydas zd1211rw: fix spelling mistake "firmeware" -> "firmware" 2016-09-03 19:59:56 +03:00
Kconfig mac80211_hwsim: move Kconfig entry for sorting alphabetically 2015-11-18 15:23:36 +02:00
mac80211_hwsim.c mac80211_hwsim: Replace bogus hrtimer clockid 2017-07-12 15:01:03 +02:00
mac80211_hwsim.h drivers/wireless: use nla_put_u64_64bit() 2016-04-26 12:00:48 -04:00
Makefile ath: unify Kconfig with other vendors 2015-11-18 14:28:31 +02:00
ray_cs.c ray_cs: Change 1 to true for bool type variable. 2015-06-02 23:30:14 +03:00
ray_cs.h ray_cs: Add include guards 2014-08-28 14:41:56 -04:00
rayctl.h ray_cs: Add include guards 2014-08-28 14:41:56 -04:00
rndis_wlan.c nl80211: support beacon report scanning 2016-07-06 14:51:31 +02:00
wl3501.h drivers/net: use __packed annotation 2010-06-03 03:18:23 -07:00
wl3501_cs.c wl3501_cs: Add spinlock to wl3501_reset 2016-09-03 13:01:18 +03:00