]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
mac80211: fix auth/assoc data & timer leak
authorJohannes Berg <johannes.berg@intel.com>
Sat, 25 Feb 2012 20:48:08 +0000 (21:48 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 27 Feb 2012 19:06:42 +0000 (14:06 -0500)
When removing an interface while it is in the
process of authenticating or associating, we
leak the auth_data or assoc_data, and leave
the timer pending. The timer then crashes the
system when it fires as its data is gone.

Fix this by explicitly deleting all the data
when the interface is removed. This uncovered
another bug -- this problem should have been
detected by the sta_info_flush() warning but
that function doesn't ever return non-zero,
I'll fix that in a separate patch.

Reported-by: Hieu Nguyen <hieux.c.nguyen@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/mac80211/ieee80211_i.h
net/mac80211/iface.c
net/mac80211/mlme.c

index 67aed1eff13542b4908e9cc73f77cc5d04f11fb4..4a722b10b4ddc788929e4321d13e58c2dd2bf604 100644 (file)
@@ -1178,6 +1178,7 @@ void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
                                  struct sk_buff *skb);
 void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata);
 void ieee80211_sta_reset_conn_monitor(struct ieee80211_sub_if_data *sdata);
+void ieee80211_mgd_teardown(struct ieee80211_sub_if_data *sdata);
 
 /* IBSS code */
 void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local);
index 6b3cd65d1e07f0d1fbea7c201410055fc8be06c3..60b240ce709ea27f93999d13c9ce4209a8e3b783 100644 (file)
@@ -644,6 +644,8 @@ static void ieee80211_teardown_sdata(struct net_device *dev)
 
        if (ieee80211_vif_is_mesh(&sdata->vif))
                mesh_rmc_free(sdata);
+       else if (sdata->vif.type == NL80211_IFTYPE_STATION)
+               ieee80211_mgd_teardown(sdata);
 
        flushed = sta_info_flush(local, sdata);
        WARN_ON(flushed);
index 1495fb99b379e3036ba4cff383c58a71434060b8..0c220e1b6c9cffac0103a78b408359bd460dee77 100644 (file)
@@ -3513,6 +3513,19 @@ int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata,
        return 0;
 }
 
+void ieee80211_mgd_teardown(struct ieee80211_sub_if_data *sdata)
+{
+       struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
+
+       mutex_lock(&ifmgd->mtx);
+       if (ifmgd->assoc_data)
+               ieee80211_destroy_assoc_data(sdata, false);
+       if (ifmgd->auth_data)
+               ieee80211_destroy_auth_data(sdata, false);
+       del_timer_sync(&ifmgd->timer);
+       mutex_unlock(&ifmgd->mtx);
+}
+
 void ieee80211_cqm_rssi_notify(struct ieee80211_vif *vif,
                               enum nl80211_cqm_rssi_threshold_event rssi_event,
                               gfp_t gfp)