Skip to contentSkip to conversation

mac80211: fix a crash in ieee80211_beacon_get_tim on change_interface

PATCH New Felix Fietkau 1 participant 1 message Jan 24, 2011 mac80211

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mac80211: fix a crash in ieee80211_beacon_get_tim on change_interface

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.

---
 net/mac80211/tx.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
net/mac80211/tx.c +3 -0
index e46c801..ffc6749 100644
@@ -2230,6 +2230,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)
Signature · 1 line
1.7.3.2