ath9k: fix crash in ath_update_survey_stats
authorFelix Fietkau <nbd@openwrt.org>
Wed, 20 Oct 2010 13:59:28 +0000 (15:59 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 25 Oct 2010 18:43:14 +0000 (14:43 -0400)
If ah->curchan is uninitialized, the channel index is bogus, which leads
to invalid memory access when the cycle counters are updated.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/main.c

index 3ff0e47..9679b31 100644 (file)
@@ -182,6 +182,9 @@ static void ath_update_survey_stats(struct ath_softc *sc)
        struct ath_cycle_counters *cc = &common->cc_survey;
        unsigned int div = common->clockrate * 1000;
 
+       if (!ah->curchan)
+               return;
+
        if (ah->power_mode == ATH9K_PM_AWAKE)
                ath_hw_cycle_counters_update(common);