From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-eopbgr720135.outbound.protection.outlook.com ([40.107.72.135]:34196 "EHLO NAM05-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388789AbeIXUxf (ORCPT ); Mon, 24 Sep 2018 16:53:35 -0400 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Emmanuel Grumbach , Luca Coelho , Johannes Berg , Sasha Levin Subject: [PATCH AUTOSEL 4.9 20/23] mac80211: don't Tx a deauth frame if the AP forbade Tx Date: Mon, 24 Sep 2018 14:49:35 +0000 Message-ID: <20180924144919.164617-20-alexander.levin@microsoft.com> References: <20180924144919.164617-1-alexander.levin@microsoft.com> In-Reply-To: <20180924144919.164617-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Emmanuel Grumbach [ Upstream commit 6c18b27d6e5c6a7206364eae2b47bc8d8b2fa68f ] If the driver fails to properly prepare for the channel switch, mac80211 will disconnect. If the CSA IE had mode set to 1, it means that the clients are not allowed to send any Tx on the current channel, and that includes the deauthentication frame. Make sure that we don't send the deauthentication frame in this case. In iwlwifi, this caused a failure to flush queues since the firmware already closed the queues after having parsed the CSA IE. Then mac80211 would wait until the deauthentication frame would go out (drv_flush(drop=3Dfalse)) and that would never happen. Signed-off-by: Emmanuel Grumbach Signed-off-by: Luca Coelho Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin --- net/mac80211/mlme.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 04e6280f4819..39451c84c785 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -1282,6 +1282,16 @@ ieee80211_sta_process_chanswitch(struct ieee80211_su= b_if_data *sdata, cbss->beacon_interval)); return; drop_connection: + /* + * This is just so that the disconnect flow will know that + * we were trying to switch channel and failed. In case the + * mode is 1 (we are not allowed to Tx), we will know not to + * send a deauthentication frame. Those two fields will be + * reset when the disconnection worker runs. + */ + sdata->vif.csa_active =3D true; + sdata->csa_block_tx =3D csa_ie.mode; + ieee80211_queue_work(&local->hw, &ifmgd->csa_connection_drop_work); mutex_unlock(&local->chanctx_mtx); mutex_unlock(&local->mtx); @@ -2454,6 +2464,7 @@ static void __ieee80211_disconnect(struct ieee80211_s= ub_if_data *sdata) struct ieee80211_local *local =3D sdata->local; struct ieee80211_if_managed *ifmgd =3D &sdata->u.mgd; u8 frame_buf[IEEE80211_DEAUTH_FRAME_LEN]; + bool tx; =20 sdata_lock(sdata); if (!ifmgd->associated) { @@ -2461,6 +2472,8 @@ static void __ieee80211_disconnect(struct ieee80211_s= ub_if_data *sdata) return; } =20 + tx =3D !sdata->csa_block_tx; + /* AP is probably out of range (or not reachable for another reason) so * remove the bss struct for that AP. */ @@ -2468,7 +2481,7 @@ static void __ieee80211_disconnect(struct ieee80211_s= ub_if_data *sdata) =20 ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY, - true, frame_buf); + tx, frame_buf); mutex_lock(&local->mtx); sdata->vif.csa_active =3D false; ifmgd->csa_waiting_bcn =3D false; @@ -2479,7 +2492,7 @@ static void __ieee80211_disconnect(struct ieee80211_s= ub_if_data *sdata) } mutex_unlock(&local->mtx); =20 - ieee80211_report_disconnect(sdata, frame_buf, sizeof(frame_buf), true, + ieee80211_report_disconnect(sdata, frame_buf, sizeof(frame_buf), tx, WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY); =20 sdata_unlock(sdata); --=20 2.17.1