summaryrefslogtreecommitdiffstats
path: root/net/mac80211/mlme.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-07-25 11:58:36 +0200
committerJohn W. Linville <linville@tuxdriver.com>2009-07-29 21:45:58 +0200
commit8d8b261a5c11bd043b9b0e0c7e6c49d57611e3ae (patch)
treee8c7205506cb7f6545c19fdb683872661127ac90 /net/mac80211/mlme.c
parentcfg80211: fix circular lock dependency (1) (diff)
downloadlinux-8d8b261a5c11bd043b9b0e0c7e6c49d57611e3ae.tar.xz
linux-8d8b261a5c11bd043b9b0e0c7e6c49d57611e3ae.zip
mac80211: fix receiving deauth
Marcel reported a warning, which quite obviously comes from an oversight in the code handling deauth frames, and which resulted in multiple follow-up warnings due to this missing handling. This patch adds the missing deauth handling (telling cfg80211 about it) and also removes the follow-up warnings since they could happen due to races even if nothing is wrong. I've explained the races in the comments. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Reported-by: Marcel Holtmann <marcel@holtmann.org> Tested-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/mlme.c')
-rw-r--r--net/mac80211/mlme.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 76c03daeb455..f60a83102ea2 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -2003,6 +2003,9 @@ static void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
case RX_MGMT_CFG80211_ASSOC:
cfg80211_send_rx_assoc(sdata->dev, (u8 *) mgmt, skb->len);
break;
+ case RX_MGMT_CFG80211_DEAUTH:
+ cfg80211_send_deauth(sdata->dev, (u8 *)mgmt, skb->len, NULL);
+ break;
default:
WARN(1, "unexpected: %d", rma);
}
@@ -2498,8 +2501,13 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,
}
}
- /* cfg80211 should catch this... */
- if (WARN_ON(!bssid)) {
+ /*
+ * cfg80211 should catch this ... but it's racy since
+ * we can receive a deauth frame, process it, hand it
+ * to cfg80211 while that's in a locked section already
+ * trying to tell us that the user wants to disconnect.
+ */
+ if (!bssid) {
mutex_unlock(&ifmgd->mtx);
return -ENOLINK;
}
@@ -2524,8 +2532,13 @@ int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata,
mutex_lock(&ifmgd->mtx);
- /* cfg80211 should catch that */
- if (WARN_ON(&ifmgd->associated->cbss != req->bss)) {
+ /*
+ * cfg80211 should catch this ... but it's racy since
+ * we can receive a disassoc frame, process it, hand it
+ * to cfg80211 while that's in a locked section already
+ * trying to tell us that the user wants to disconnect.
+ */
+ if (&ifmgd->associated->cbss != req->bss) {
mutex_unlock(&ifmgd->mtx);
return -ENOLINK;
}