aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/mlme.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index d29762fdd887..02ffe8738243 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -3662,40 +3662,44 @@ int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,
3662 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 3662 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
3663 u8 frame_buf[IEEE80211_DEAUTH_FRAME_LEN]; 3663 u8 frame_buf[IEEE80211_DEAUTH_FRAME_LEN];
3664 bool tx = !req->local_state_change; 3664 bool tx = !req->local_state_change;
3665 bool sent_frame = false;
3665 3666
3666 mutex_lock(&ifmgd->mtx); 3667 mutex_lock(&ifmgd->mtx);
3667 3668
3668 if (ifmgd->auth_data) {
3669 ieee80211_destroy_auth_data(sdata, false);
3670 mutex_unlock(&ifmgd->mtx);
3671 return 0;
3672 }
3673
3674 sdata_info(sdata, 3669 sdata_info(sdata,
3675 "deauthenticating from %pM by local choice (reason=%d)\n", 3670 "deauthenticating from %pM by local choice (reason=%d)\n",
3676 req->bssid, req->reason_code); 3671 req->bssid, req->reason_code);
3677 3672
3678 if (ifmgd->associated && 3673 if (ifmgd->auth_data) {
3679 ether_addr_equal(ifmgd->associated->bssid, req->bssid)) {
3680 ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH,
3681 req->reason_code, tx, frame_buf);
3682 } else {
3683 drv_mgd_prepare_tx(sdata->local, sdata); 3674 drv_mgd_prepare_tx(sdata->local, sdata);
3684 ieee80211_send_deauth_disassoc(sdata, req->bssid, 3675 ieee80211_send_deauth_disassoc(sdata, req->bssid,
3685 IEEE80211_STYPE_DEAUTH, 3676 IEEE80211_STYPE_DEAUTH,
3686 req->reason_code, tx, 3677 req->reason_code, tx,
3687 frame_buf); 3678 frame_buf);
3679 ieee80211_destroy_auth_data(sdata, false);
3680 mutex_unlock(&ifmgd->mtx);
3681
3682 sent_frame = tx;
3683 goto out;
3688 } 3684 }
3689 3685
3686 if (ifmgd->associated &&
3687 ether_addr_equal(ifmgd->associated->bssid, req->bssid)) {
3688 ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH,
3689 req->reason_code, tx, frame_buf);
3690 sent_frame = tx;
3691 }
3690 mutex_unlock(&ifmgd->mtx); 3692 mutex_unlock(&ifmgd->mtx);
3691 3693
3692 __cfg80211_send_deauth(sdata->dev, frame_buf, 3694 out:
3693 IEEE80211_DEAUTH_FRAME_LEN);
3694
3695 mutex_lock(&sdata->local->mtx); 3695 mutex_lock(&sdata->local->mtx);
3696 ieee80211_recalc_idle(sdata->local); 3696 ieee80211_recalc_idle(sdata->local);
3697 mutex_unlock(&sdata->local->mtx); 3697 mutex_unlock(&sdata->local->mtx);
3698 3698
3699 if (sent_frame)
3700 __cfg80211_send_deauth(sdata->dev, frame_buf,
3701 IEEE80211_DEAUTH_FRAME_LEN);
3702
3699 return 0; 3703 return 0;
3700} 3704}
3701 3705