From patchwork Fri Oct 20 03:48:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lin X-Patchwork-Id: 13430037 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F549CDB474 for ; Fri, 20 Oct 2023 03:48:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376294AbjJTDs3 (ORCPT ); Thu, 19 Oct 2023 23:48:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346903AbjJTDs0 (ORCPT ); Thu, 19 Oct 2023 23:48:26 -0400 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2050.outbound.protection.outlook.com [40.107.21.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C9B5D6D; Thu, 19 Oct 2023 20:48:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FRsiYkBRwYEISV0mMtD8nJSl6GK2DudrD2EBQG3+sN9y4GohpbXbrpXdEwy7KVfeqFdeM0Z40Cm9/14/nSrTOC+VEtNwQF+KALV6WYHT5llKrW4Fq9HebW1+ReAE3KBYd5X+d6FoBWNe82MyQDuzBM1kVbIU7rzF3Us5nBMUgvtAtcD0Q5QoNRF2IeMV0OiRbjRfT1NxRAD+Wk1Dkuk2Yk4jOUdbuTvxdQIax163mKp3arM1w4XCM1LTuKchAuTMY5WDOsY77uibbc8lhq7qVcSUnj+o5sWOn3QSKdiKR9HnlCF/xgpw3NvkIzRPkGT+gN3TyB6QULEq3ovohrr8Rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=oWRcRKmudbqI0qax2S4mo8MMj1VvT9eC/WKABK8rIuU=; b=ZwGqSqIsw5TG+w4B6eViCpm6W1O2OI6YFQr7HPzdvCuW2BwAwvXEVMAWMkn6zTXqbkBjwfCbCZeRU/2MDNaxzC2vZ6HcXUl7jm+GVgH2P6JPDkl+g14RFtQDTpfSgofeonWkW9vW2UhnVAvAEqpHe1T1F+0A4eyUHhr3D5iG7tKgtHSy9fp8T2XLIny0Hva9lDo+gPz5g4tZj19ssRYgmuwUcsh5YKzYXaUjxe/7zeInD/vagecmkGPCAM7YtUkJ/bwUPA91670hEoxiYd8bGDJf+jG568UbCi8QF6CAAX+SoONnsMW3eJfTOQBqYQqnXPN0SUWcECS2TJyMmggcLA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=oWRcRKmudbqI0qax2S4mo8MMj1VvT9eC/WKABK8rIuU=; b=ESPEU+zYGvwHjCgfCnaz5oTs7SEDR14Funhzm05uM4QXgseAHKx2SUWW4pzAPOVeljFdwmjWG1zkcgmp5W0qqJuXc5cZPZYTM3xSjzkSQXKjoVhOiHuITo2iWhUtwPXSXb/yjcVAqXK2zL0WuiZWn4Y6OerNnyGhIc9Yksj0XFo= Received: from PA4PR04MB9638.eurprd04.prod.outlook.com (2603:10a6:102:273::20) by VI1PR04MB7069.eurprd04.prod.outlook.com (2603:10a6:800:127::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.11; Fri, 20 Oct 2023 03:48:18 +0000 Received: from PA4PR04MB9638.eurprd04.prod.outlook.com ([fe80::34dd:289e:9e8b:9c9b]) by PA4PR04MB9638.eurprd04.prod.outlook.com ([fe80::34dd:289e:9e8b:9c9b%7]) with mapi id 15.20.6933.011; Fri, 20 Oct 2023 03:48:18 +0000 From: David Lin To: "linux-wireless@vger.kernel.org" CC: "linux-kernel@vger.kernel.org" , "briannorris@chromium.org" , "kvalo@kernel.org" , "francesco@dolcini.it" , Sharvari Harisangam , David Lin , Pete Hsieh Subject: [PATCH v6 3/6] wifi: mwifiex: fixed reassocation issue for WPA3. Thread-Topic: [PATCH v6 3/6] wifi: mwifiex: fixed reassocation issue for WPA3. Thread-Index: AdoDCEJxeqzS6xZwTgO7r0FJr3DzXg== Date: Fri, 20 Oct 2023 03:48:18 +0000 Message-ID: Accept-Language: zh-TW, en-US Content-Language: zh-TW X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: PA4PR04MB9638:EE_|VI1PR04MB7069:EE_ x-ms-office365-filtering-correlation-id: 0a19f5d0-4237-47d3-19cd-08dbd11f65f1 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: LqiAaTNomxCmNJtmUoFX/m5xYIWNs1jN1uWtFEtStHsH6gsFsfgt4jPfy1RgTWCpLdloO44tZ40c8aj28Nfn8aUMFkDSWwgWdOVu6nuOoFCSmFLwNP/1/dHlqFNw0C63GbxVmdqon7ncTcyOan4/OsShB4hm0QQgeEMwkBQtr2zGAEdYoc7uPjScvHx00jOJ2/iJMliNLHO+ew8kR0SHrfV/QIyO+VIZrX54uQEA6qlCxu0VXbrbIVVNLj5onYBYt+zHwOAh/qvx2vy+5b6N5X6k5cOJWP0fFkfOrArzoTdWugoDVMl9+vm7Yi+R8jRi6K5Y5IZFffJUnhEJDaN/4YtACFWXTzqorGO/xwW2XjVlmjzwed9p/xu27gsRRKKSC2EoK1mHOT1SziuKmjTIY2kwcFSntusu6c5/UuxblUpvi/BXUd8xv0WBSJMh5Azqmk7hVd1J7ZBCFPGAB29QaOSybAlGdfTvOLLI0GCXeeu0LQckgh2NZUhes6BnHL4N5PX/POAQvbTPAXp9pVzLyJVOkfELa3MMpNbgoFTLGjdXeu6AScyBpkkEAxefpssIhItMTCtxjsQV31Px8MAoNm1Ujpt+Qu4Bg6OAQfQhGc8grg5WTTxVOuAYjYlH4Csq x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PA4PR04MB9638.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(396003)(136003)(376002)(39860400002)(346002)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(55016003)(38100700002)(41300700001)(4326008)(5660300002)(8676002)(8936002)(52536014)(86362001)(33656002)(2906002)(122000001)(478600001)(83380400001)(9686003)(7696005)(26005)(71200400001)(6506007)(316002)(38070700009)(66946007)(76116006)(54906003)(66476007)(6916009)(66446008)(64756008)(66556008);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: 4TNAOIhXvU0xmZTH030DM/P32GTPIhQNHLoBFiOlinidjzbt4ixfKmELlwzg4vhgyj67Jt4MP1J6ejVjxFBLcoSkpuKx6ZWr83Ku1s4hxdm9tIukBIy/14/ChmDjBGOd6NhnkQAMwpYXk/gn0xpEKD0UF2QQMqZfpxGsGqghGKldIinOZrGO0BME7SwA01X2dltvsN7pA7vq2tSeiCoVnXAkLp3YUMkGCdd0FQ2QD4bTZ3JwLPsMy60JKUZs7y6smyukRI5RWsgDs2RzBHV28FOZOU8DUXgmH/O3htCdFchd3GW5A7DVTp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4i+FoDpvqK3G49P5rp66CUZNfa2ohEJpy3HdgSGUj52yFBc3U6FDJr/K50pS+aN4k+sCzmiraPaH9pZIvkq7Oqx/43FuQ4dBwq/bHi2XHtVqjYDcO+c2Yu558ILuhYtLgAhrGEI0itN+YFZM9VgLpt7tK7yXkFHDdLOGiEGmWmXzAYJEtjnZtNSFxRKdoW8LzMGN0lBNZeAmt MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: PA4PR04MB9638.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0a19f5d0-4237-47d3-19cd-08dbd11f65f1 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Oct 2023 03:48:18.7311 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 2Gd5ZLNpi4Dhy6bBJY+ZdwpfGbC8abUoWG9L9pWCdWqFgcpI0f+buUQYyli0NLPuWpViKbU5hoGTgh6XVSOf5g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB7069 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org This issue is related to resatart/reconfigure AP. When AP is restarted or reconfigured, wpa_supplilcant will use cached PMKSA to do association to AP. Because association failure does not report to cfg80211/wpa_supplicant, wpa_supplicant will always use cached PMKSA to do assocaiton. Connection can't be established under this way. Signed-off-by: David Lin --- .../net/wireless/marvell/mwifiex/cfg80211.c | 25 ++++++++----------- drivers/net/wireless/marvell/mwifiex/cmdevt.c | 18 +++++++++++++ drivers/net/wireless/marvell/mwifiex/init.c | 1 + drivers/net/wireless/marvell/mwifiex/main.c | 6 +++++ drivers/net/wireless/marvell/mwifiex/main.h | 3 +++ 5 files changed, 39 insertions(+), 14 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index 3d59e6a441b9..a21310f3807c 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -4395,9 +4395,6 @@ mwifiex_cfg80211_associate(struct wiphy *wiphy, struct net_device *dev, int ret; struct cfg80211_ssid req_ssid; const u8 *ssid_ie; - struct cfg80211_rx_assoc_resp assoc_resp = { - .uapsd_queues = -1, - }; if (GET_BSS_ROLE(priv) != MWIFIEX_BSS_ROLE_STA) { mwifiex_dbg(adapter, ERROR, @@ -4433,13 +4430,13 @@ mwifiex_cfg80211_associate(struct wiphy *wiphy, struct net_device *dev, req_ssid.ssid_len = ssid_ie[1]; if (req_ssid.ssid_len > IEEE80211_MAX_SSID_LEN) { - mwifiex_dbg(priv->adapter, ERROR, "invalid SSID - aborting\n"); + mwifiex_dbg(adapter, ERROR, "invalid SSID - aborting\n"); goto ssid_err; } memcpy(req_ssid.ssid, ssid_ie + 2, req_ssid.ssid_len); if (!req_ssid.ssid_len || req_ssid.ssid[0] < 0x20) { - mwifiex_dbg(priv->adapter, ERROR, "invalid SSID - aborting\n"); + mwifiex_dbg(adapter, ERROR, "invalid SSID - aborting\n"); goto ssid_err; } rcu_read_unlock(); @@ -4466,25 +4463,25 @@ mwifiex_cfg80211_associate(struct wiphy *wiphy, struct net_device *dev, memcpy(priv->cfg_bssid, req->bss->bssid, ETH_ALEN); - mwifiex_dbg(priv->adapter, MSG, + mwifiex_dbg(adapter, MSG, "assoc: send association to %pM\n", req->bss->bssid); - cfg80211_ref_bss(priv->adapter->wiphy, req->bss); + cfg80211_ref_bss(adapter->wiphy, req->bss); ret = mwifiex_bss_start(priv, req->bss, &req_ssid); - if (!ret) { - assoc_resp.links[0].bss = priv->attempted_bss_desc->bss; - assoc_resp.buf = priv->assoc_rsp_buf; - assoc_resp.len = priv->assoc_rsp_size; - cfg80211_rx_assoc_resp(priv->netdev, - &assoc_resp); - } else { + if (ret) { priv->auth_flag = 0; priv->auth_alg = 0xFFFF; eth_zero_addr(priv->cfg_bssid); } + if (priv->assoc_rsp_size) { + priv->req_bss = req->bss; + adapter->assoc_resp_received = true; + queue_work(adapter->workqueue, &adapter->main_work); + } + cfg80211_put_bss(priv->adapter->wiphy, req->bss); return 0; diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c b/drivers/net/wireless/marvell/mwifiex/cmdevt.c index 311af5f40c3e..16777af50097 100644 --- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c +++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c @@ -924,6 +924,24 @@ int mwifiex_process_cmdresp(struct mwifiex_adapter *adapter) return ret; } +void mwifiex_process_assoc_resp(struct mwifiex_adapter *adapter) +{ + struct cfg80211_rx_assoc_resp assoc_resp = { + .uapsd_queues = -1, + }; + struct mwifiex_private *priv = + mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA); + + if (priv->assoc_rsp_size) { + assoc_resp.links[0].bss = priv->req_bss; + assoc_resp.buf = priv->assoc_rsp_buf; + assoc_resp.len = priv->assoc_rsp_size; + cfg80211_rx_assoc_resp(priv->netdev, + &assoc_resp); + priv->assoc_rsp_size = 0; + } +} + /* * This function handles the timeout of command sending. * diff --git a/drivers/net/wireless/marvell/mwifiex/init.c b/drivers/net/wireless/marvell/mwifiex/init.c index f86a527fd7ca..4326e03a66d3 100644 --- a/drivers/net/wireless/marvell/mwifiex/init.c +++ b/drivers/net/wireless/marvell/mwifiex/init.c @@ -223,6 +223,7 @@ static void mwifiex_init_adapter(struct mwifiex_adapter *adapter) adapter->cmd_resp_received = false; adapter->event_received = false; adapter->data_received = false; + adapter->assoc_resp_received = false; clear_bit(MWIFIEX_SURPRISE_REMOVED, &adapter->work_flags); diff --git a/drivers/net/wireless/marvell/mwifiex/main.c b/drivers/net/wireless/marvell/mwifiex/main.c index 3bebb6c37604..1dac77946813 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.c +++ b/drivers/net/wireless/marvell/mwifiex/main.c @@ -365,6 +365,12 @@ int mwifiex_main_process(struct mwifiex_adapter *adapter) } } + /* Chekc for Assoc Resp */ + if (adapter->assoc_resp_received) { + adapter->assoc_resp_received = false; + mwifiex_process_assoc_resp(adapter); + } + /* Check if we need to confirm Sleep Request received previously */ if (adapter->ps_state == PS_STATE_PRE_SLEEP) diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h index 83449ad84d15..ae4b44ad6c50 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h @@ -615,6 +615,7 @@ struct mwifiex_private { #define MWIFIEX_ASSOC_RSP_BUF_SIZE 500 u8 assoc_rsp_buf[MWIFIEX_ASSOC_RSP_BUF_SIZE]; u32 assoc_rsp_size; + struct cfg80211_bss *req_bss; #define MWIFIEX_GENIE_BUF_SIZE 256 u8 gen_ie_buf[MWIFIEX_GENIE_BUF_SIZE]; @@ -915,6 +916,7 @@ struct mwifiex_adapter { u8 cmd_resp_received; u8 event_received; u8 data_received; + u8 assoc_resp_received; u16 seq_num; struct cmd_ctrl_node *cmd_pool; struct cmd_ctrl_node *curr_cmd; @@ -1104,6 +1106,7 @@ void mwifiex_insert_cmd_to_pending_q(struct mwifiex_adapter *adapter, int mwifiex_exec_next_cmd(struct mwifiex_adapter *adapter); int mwifiex_process_cmdresp(struct mwifiex_adapter *adapter); +void mwifiex_process_assoc_resp(struct mwifiex_adapter *adapter); int mwifiex_handle_rx_packet(struct mwifiex_adapter *adapter, struct sk_buff *skb); int mwifiex_process_tx(struct mwifiex_private *priv, struct sk_buff *skb,