]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mac80211: fix a crash in ieee80211_beacon_get_tim on change_interface
authorFelix Fietkau <nbd@openwrt.org>
Mon, 24 Jan 2011 18:28:49 +0000 (19:28 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 17 Feb 2011 23:13:51 +0000 (15:13 -0800)
commit eb3e554b4b3a56386ef5214dbe0e3935a350178b upstream.

Some drivers (e.g. ath9k) do not always disable beacons when they're
supposed to. When an interface is changed using the change_interface op,
the mode specific sdata part is in an undefined state and trying to
get a beacon at this point can produce weird crashes.

To fix this, add a check for ieee80211_sdata_running before using
anything from the sdata.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
net/mac80211/tx.c

index 7a637b80a62ef7a8d00d49285d9d6995b4083d9e..e2d33cf0c40733196b5c485d3d75f615e946bd82 100644 (file)
@@ -2207,6 +2207,9 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw,
 
        sdata = vif_to_sdata(vif);
 
+       if (!ieee80211_sdata_running(sdata))
+               goto out;
+
        if (tim_offset)
                *tim_offset = 0;
        if (tim_length)