diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2009-07-25 05:58:36 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-07-29 15:45:58 -0400 |
commit | 8d8b261a5c11bd043b9b0e0c7e6c49d57611e3ae (patch) | |
tree | e8c7205506cb7f6545c19fdb683872661127ac90 | |
parent | bc43b28c10855aa56f6d0bd64ec6a6d8edbcf11b (diff) |
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>
-rw-r--r-- | net/mac80211/mlme.c | 21 |
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, | |||
2003 | case RX_MGMT_CFG80211_ASSOC: | 2003 | case RX_MGMT_CFG80211_ASSOC: |
2004 | cfg80211_send_rx_assoc(sdata->dev, (u8 *) mgmt, skb->len); | 2004 | cfg80211_send_rx_assoc(sdata->dev, (u8 *) mgmt, skb->len); |
2005 | break; | 2005 | break; |
2006 | case RX_MGMT_CFG80211_DEAUTH: | ||
2007 | cfg80211_send_deauth(sdata->dev, (u8 *)mgmt, skb->len, NULL); | ||
2008 | break; | ||
2006 | default: | 2009 | default: |
2007 | WARN(1, "unexpected: %d", rma); | 2010 | WARN(1, "unexpected: %d", rma); |
2008 | } | 2011 | } |
@@ -2498,8 +2501,13 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata, | |||
2498 | } | 2501 | } |
2499 | } | 2502 | } |
2500 | 2503 | ||
2501 | /* cfg80211 should catch this... */ | 2504 | /* |
2502 | if (WARN_ON(!bssid)) { | 2505 | * cfg80211 should catch this ... but it's racy since |
2506 | * we can receive a deauth frame, process it, hand it | ||
2507 | * to cfg80211 while that's in a locked section already | ||
2508 | * trying to tell us that the user wants to disconnect. | ||
2509 | */ | ||
2510 | if (!bssid) { | ||
2503 | mutex_unlock(&ifmgd->mtx); | 2511 | mutex_unlock(&ifmgd->mtx); |
2504 | return -ENOLINK; | 2512 | return -ENOLINK; |
2505 | } | 2513 | } |
@@ -2524,8 +2532,13 @@ int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata, | |||
2524 | 2532 | ||
2525 | mutex_lock(&ifmgd->mtx); | 2533 | mutex_lock(&ifmgd->mtx); |
2526 | 2534 | ||
2527 | /* cfg80211 should catch that */ | 2535 | /* |
2528 | if (WARN_ON(&ifmgd->associated->cbss != req->bss)) { | 2536 | * cfg80211 should catch this ... but it's racy since |
2537 | * we can receive a disassoc frame, process it, hand it | ||
2538 | * to cfg80211 while that's in a locked section already | ||
2539 | * trying to tell us that the user wants to disconnect. | ||
2540 | */ | ||
2541 | if (&ifmgd->associated->cbss != req->bss) { | ||
2529 | mutex_unlock(&ifmgd->mtx); | 2542 | mutex_unlock(&ifmgd->mtx); |
2530 | return -ENOLINK; | 2543 | return -ENOLINK; |
2531 | } | 2544 | } |