aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath/ath5k/phy.c
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2013-02-07 14:44:40 +0100
committerJohn W. Linville <linville@tuxdriver.com>2013-02-08 14:51:35 -0500
commitc5e534e569fd07991d4d09921c73823cd5e4115e (patch)
tree622101388098cd26f07b1a576291bdb988957916 /drivers/net/wireless/ath/ath5k/phy.c
parentrtlwifi: rtl8192cu: Fix NULL dereference BUG when using new_id (diff)
downloadlinux-dev-c5e534e569fd07991d4d09921c73823cd5e4115e.tar.xz
linux-dev-c5e534e569fd07991d4d09921c73823cd5e4115e.zip
NET: ath5k, check ath5k_eeprom_mode_from_channel retval
It can, if invalid argument given, return a negative value. In that case we would access arrays out-of-bounds and such. Check the value and yell loudly if that happened as it would be a bug in the implementation. (Instead of silently corrupting memory.) Signed-off-by: Jiri Slaby <jslaby@suse.cz> Cc: Nick Kossifidis <mickflemm@gmail.com> Cc: "Luis R. Rodriguez" <mcgrof@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath/ath5k/phy.c')
-rw-r--r--drivers/net/wireless/ath/ath5k/phy.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c
index ab363f34b4df..a78afa98c650 100644
--- a/drivers/net/wireless/ath/ath5k/phy.c
+++ b/drivers/net/wireless/ath/ath5k/phy.c
@@ -1613,6 +1613,10 @@ ath5k_hw_update_noise_floor(struct ath5k_hw *ah)
ah->ah_cal_mask |= AR5K_CALIBRATION_NF;
ee_mode = ath5k_eeprom_mode_from_channel(ah->ah_current_channel);
+ if (WARN_ON(ee_mode < 0)) {
+ ah->ah_cal_mask &= ~AR5K_CALIBRATION_NF;
+ return;
+ }
/* completed NF calibration, test threshold */
nf = ath5k_hw_read_measured_noise_floor(ah);