]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
ath9k: Prevent divide-by-zero upon bad beacon_interval.
authorBen Greear <greearb@candelatech.com>
Wed, 30 Apr 2014 19:02:05 +0000 (12:02 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 6 May 2014 18:51:01 +0000 (14:51 -0400)
A similar patch fixed crashes seen on an ath9k system
when testing against a broken ath10k AP.  This patch
is slightly less protective, but probably will do the
job and is less redundant.

Signed-off-by: Ben Greear <greearb@candelatech.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath9k/beacon.c
drivers/net/wireless/ath/ath9k/recv.c

index bd9e634879e69d4b2b33d741f7c4a8c51801ba9f..e387f0b2954a0cf5500610b330f744a5b68cd69c 100644 (file)
@@ -537,8 +537,6 @@ static void ath9k_cache_beacon_config(struct ath_softc *sc,
        cur_conf->dtim_period = bss_conf->dtim_period;
        cur_conf->dtim_count = 1;
        cur_conf->ibss_creator = bss_conf->ibss_creator;
-       cur_conf->bmiss_timeout =
-               ATH_DEFAULT_BMISS_LIMIT * cur_conf->beacon_interval;
 
        /*
         * It looks like mac80211 may end up using beacon interval of zero in
@@ -549,6 +547,9 @@ static void ath9k_cache_beacon_config(struct ath_softc *sc,
        if (cur_conf->beacon_interval == 0)
                cur_conf->beacon_interval = 100;
 
+       cur_conf->bmiss_timeout =
+               ATH_DEFAULT_BMISS_LIMIT * cur_conf->beacon_interval;
+
        /*
         * We don't parse dtim period from mac80211 during the driver
         * initialization as it breaks association with hidden-ssid
index a01efd3e741e45713b5c1f5bb8264a955218ac21..a1fac6bdbb045989072bbdcc7a8b5f1322bccc63 100644 (file)
@@ -538,8 +538,8 @@ static void ath_rx_ps_beacon(struct ath_softc *sc, struct sk_buff *skb)
                sc->ps_flags &= ~PS_BEACON_SYNC;
                ath_dbg(common, PS,
                        "Reconfigure beacon timers based on synchronized timestamp\n");
-               ath9k_set_beacon(sc);
-
+               if (!(WARN_ON_ONCE(sc->cur_beacon_conf.beacon_interval == 0)))
+                       ath9k_set_beacon(sc);
                if (sc->p2p_ps_vif)
                        ath9k_update_p2p_ps(sc, sc->p2p_ps_vif->vif);
        }