Skip to content

Commit 1a1cb74

Browse files
committed
mac80211: fix suspend vs. authentication race
Since Stanislaw's patch removing the quiescing code, mac80211 had a race regarding suspend vs. authentication: as cfg80211 doesn't track authentication attempts, it can't abort them. Therefore the attempts may be kept running while suspending, which can lead to all kinds of issues, in at least some cases causing an error in iwlmvm firmware. Fix this by aborting the authentication attempt when suspending. Cc: stable@vger.kernel.org Fixes: 12e7f51 ("mac80211: cleanup generic suspend/resume procedures") Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent c9c3a06 commit 1a1cb74

3 files changed

Lines changed: 38 additions & 3 deletions

File tree

‎net/mac80211/ieee80211_i.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,6 +1391,7 @@ void ieee80211_sta_reset_conn_monitor(struct ieee80211_sub_if_data *sdata);
13911391
void ieee80211_mgd_stop(struct ieee80211_sub_if_data *sdata);
13921392
void ieee80211_mgd_conn_tx_status(struct ieee80211_sub_if_data *sdata,
13931393
__le16 fc, bool acked);
1394+
void ieee80211_mgd_quiesce(struct ieee80211_sub_if_data *sdata);
13941395
void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata);
13951396

13961397
/* IBSS code */

‎net/mac80211/mlme.c‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3576,6 +3576,32 @@ static void ieee80211_restart_sta_timer(struct ieee80211_sub_if_data *sdata)
35763576
}
35773577

35783578
#ifdef CONFIG_PM
3579+
void ieee80211_mgd_quiesce(struct ieee80211_sub_if_data *sdata)
3580+
{
3581+
struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
3582+
u8 frame_buf[IEEE80211_DEAUTH_FRAME_LEN];
3583+
3584+
sdata_lock(sdata);
3585+
3586+
if (ifmgd->auth_data) {
3587+
/*
3588+
* If we are trying to authenticate while suspending, cfg80211
3589+
* won't know and won't actually abort those attempts, thus we
3590+
* need to do that ourselves.
3591+
*/
3592+
ieee80211_send_deauth_disassoc(sdata,
3593+
ifmgd->auth_data->bss->bssid,
3594+
IEEE80211_STYPE_DEAUTH,
3595+
WLAN_REASON_DEAUTH_LEAVING,
3596+
false, frame_buf);
3597+
ieee80211_destroy_auth_data(sdata, false);
3598+
cfg80211_tx_mlme_mgmt(sdata->dev, frame_buf,
3599+
IEEE80211_DEAUTH_FRAME_LEN);
3600+
}
3601+
3602+
sdata_unlock(sdata);
3603+
}
3604+
35793605
void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata)
35803606
{
35813607
struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;

‎net/mac80211/pm.c‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,18 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)
100100

101101
/* remove all interfaces that were created in the driver */
102102
list_for_each_entry(sdata, &local->interfaces, list) {
103-
if (!ieee80211_sdata_running(sdata) ||
104-
sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
105-
sdata->vif.type == NL80211_IFTYPE_MONITOR)
103+
if (!ieee80211_sdata_running(sdata))
106104
continue;
105+
switch (sdata->vif.type) {
106+
case NL80211_IFTYPE_AP_VLAN:
107+
case NL80211_IFTYPE_MONITOR:
108+
continue;
109+
case NL80211_IFTYPE_STATION:
110+
ieee80211_mgd_quiesce(sdata);
111+
break;
112+
default:
113+
break;
114+
}
107115

108116
drv_remove_interface(local, sdata);
109117
}

0 commit comments

Comments
 (0)