mac80211: fix potential use-after-free
authorJohannes Berg <johannes.berg@intel.com>
Tue, 4 Mar 2014 10:43:28 +0000 (11:43 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 19 Mar 2014 20:29:52 +0000 (21:29 +0100)
The bss struct might be freed in ieee80211_rx_bss_put(),
so we shouldn't use it afterwards.

Cc: stable@vger.kernel.org (3.10+)
Fixes: 817cee7675237 ("mac80211: track AP's beacon rate and give it to the driver")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/mlme.c

index 46b62bb3677ccbad6b29446a82f2413e97b9ad29..423816f18b55701e6dd0d078b1b077d71a663d2f 100644 (file)
@@ -2780,8 +2780,8 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
        bss = ieee80211_bss_info_update(local, rx_status, mgmt, len, elems,
                                        channel);
        if (bss) {
-               ieee80211_rx_bss_put(local, bss);
                sdata->vif.bss_conf.beacon_rate = bss->beacon_rate;
+               ieee80211_rx_bss_put(local, bss);
        }
 }