mac80211: avoid crashing when no scan sdata
authorJohannes Berg <johannes@sipsolutions.net>
Wed, 15 Apr 2009 19:33:15 +0000 (21:33 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 17 Apr 2009 19:27:13 +0000 (15:27 -0400)
Using the scan_sdata variable here is terribly wrong,
if there has never been a scan then we fail. However,
we need a bandaid...

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Cc: stable@kernel.org [2.6.29]
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/mac80211/mlme.c

index 1b14d02..dc60804 100644 (file)
@@ -2113,12 +2113,13 @@ void ieee80211_dynamic_ps_enable_work(struct work_struct *work)
        struct ieee80211_local *local =
                container_of(work, struct ieee80211_local,
                             dynamic_ps_enable_work);
+       /* XXX: using scan_sdata is completely broken! */
        struct ieee80211_sub_if_data *sdata = local->scan_sdata;
 
        if (local->hw.conf.flags & IEEE80211_CONF_PS)
                return;
 
-       if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK)
+       if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK && sdata)
                ieee80211_send_nullfunc(local, sdata, 1);
 
        local->hw.conf.flags |= IEEE80211_CONF_PS;