浏览代码

mac80211: Protect Deauthentication frame when using MFP

When management frame protection (IEEE 802.11w) is used,
Deauthentication frame needs to be protected when the pairwise key is
configured. mac80211 was removing the station entry (and its keys)
before actually sending out the Deauthentication frame. Fix this by
reordering the code to send the frame before the station entry gets
removed. This matches an earlier change that handled the Disassociation
frame processing, but missed Deauthentication frames.

Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Jouni Malinen 15 年之前
父节点
当前提交
05e48e8e43
共有 1 个文件被更改,包括 7 次插入3 次删除
  1. 7 3
      net/mac80211/mlme.c

+ 7 - 3
net/mac80211/mlme.c

@@ -2158,14 +2158,16 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,
 	struct ieee80211_local *local = sdata->local;
 	struct ieee80211_local *local = sdata->local;
 	struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
 	struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
 	struct ieee80211_work *wk;
 	struct ieee80211_work *wk;
-	const u8 *bssid = req->bss->bssid;
+	u8 bssid[ETH_ALEN];
+	bool assoc_bss = false;
 
 
 	mutex_lock(&ifmgd->mtx);
 	mutex_lock(&ifmgd->mtx);
 
 
+	memcpy(bssid, req->bss->bssid, ETH_ALEN);
 	if (ifmgd->associated == req->bss) {
 	if (ifmgd->associated == req->bss) {
-		bssid = req->bss->bssid;
-		ieee80211_set_disassoc(sdata, true);
+		ieee80211_set_disassoc(sdata, false);
 		mutex_unlock(&ifmgd->mtx);
 		mutex_unlock(&ifmgd->mtx);
+		assoc_bss = true;
 	} else {
 	} else {
 		bool not_auth_yet = false;
 		bool not_auth_yet = false;
 
 
@@ -2211,6 +2213,8 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,
 	ieee80211_send_deauth_disassoc(sdata, bssid, IEEE80211_STYPE_DEAUTH,
 	ieee80211_send_deauth_disassoc(sdata, bssid, IEEE80211_STYPE_DEAUTH,
 				       req->reason_code, cookie,
 				       req->reason_code, cookie,
 				       !req->local_state_change);
 				       !req->local_state_change);
+	if (assoc_bss)
+		sta_info_destroy_addr(sdata, bssid);
 
 
 	ieee80211_recalc_idle(sdata->local);
 	ieee80211_recalc_idle(sdata->local);