From patchwork Fri Jul 22 11:56:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alvin_=C5=A0ipraga?= X-Patchwork-Id: 12926406 X-Patchwork-Delegate: kuba@kernel.org 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 AFF85CCA489 for ; Fri, 22 Jul 2022 11:56:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234933AbiGVL45 (ORCPT ); Fri, 22 Jul 2022 07:56:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234542AbiGVL4y (ORCPT ); Fri, 22 Jul 2022 07:56:54 -0400 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EB949D525 for ; Fri, 22 Jul 2022 04:56:51 -0700 (PDT) Received: by mail-ed1-x530.google.com with SMTP id u12so537257edd.5 for ; Fri, 22 Jul 2022 04:56:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pqrs.dk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=sfJUu7YZvL2g6twgjpnle5UI1onmUJrVs9Bpz3S5FYc=; b=a/t5NXgblmEZvwDxJtbKMOHWIKIUzapVoC99aGhYw62vKNQwYr4NY31RzsQSeqyD8D IzHdYKfuLcMwGch+03d8fDOtaIf2+q1jmpsrJpiXnxcuLg+2296EziHOIKR/4W63mUhU otDP3qwJ5QLtaAnqiw2t7sJsKMp7T53cJfmzY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=sfJUu7YZvL2g6twgjpnle5UI1onmUJrVs9Bpz3S5FYc=; b=wMzexI5WTiFkI2MdNGbx24UQzFQ1S++Wk1pCiWl3VlxrP1z6/oh1zECJn/LBcSKkhU DRPlkh6ESLHwRzUKPy4d/KoxespRLuEoLClVy+hXddH5xv2r3+W7YrBTXneq52ZQf1aQ YQ51gl4k/a8zTfvbQZhofMUhOtI3MuEwgpJyddbSrPlJUhXV3NJcqYm0E2TKhjzuZNmL LZV2m7qHRnBtLxHErCfu1/JpDLY7Gv1lcRVy+1MOmTuei95yoCd0ThBOAjjz5KRmh25F 3lVL35s6gt0atFij9l/ucvnELv5COF+IAmshgUTu0o1B3TkcEgBfddoIabjB3amNv6OL kiUw== X-Gm-Message-State: AJIora8OAP4i9KXTbBiRvrYHEvkLvX4RJOj09JD74VmJrLvt2TyestZh lLadkspTwlcsWEV7K6uTof027w== X-Google-Smtp-Source: AGRyM1vWDrGN9LZIzRynXR7EHhhtZ1o+0jbyaoh2maJYcYi6kAJuctrUKwkKKcU6r/5iaFjBTBkPSQ== X-Received: by 2002:a05:6402:278e:b0:43a:9cf5:6608 with SMTP id b14-20020a056402278e00b0043a9cf56608mr298484ede.76.1658491009835; Fri, 22 Jul 2022 04:56:49 -0700 (PDT) Received: from localhost.localdomain (80.71.142.18.ipv4.parknet.dk. [80.71.142.18]) by smtp.gmail.com with ESMTPSA id kx6-20020a170907774600b0072b3182368fsm1934370ejc.77.2022.07.22.04.56.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Jul 2022 04:56:49 -0700 (PDT) From: =?utf-8?q?Alvin_=C5=A0ipraga?= To: Arend van Spriel , Franky Lin , Hante Meuleman , Kalle Valo , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Wright Feng , Chi-hsien Lin , Ahmad Fatoum , =?utf-8?q?Alvin_=C5=A0ipraga?= , linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, SHA-cyfmac-dev-list@infineon.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/6] brcmfmac: fix continuous 802.1x tx pending timeout error Date: Fri, 22 Jul 2022 13:56:26 +0200 Message-Id: <20220722115632.620681-2-alvin@pqrs.dk> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220722115632.620681-1-alvin@pqrs.dk> References: <20220722115632.620681-1-alvin@pqrs.dk> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Wright Feng The race condition in brcmf_msgbuf_txflow and brcmf_msgbuf_delete_flowring makes tx_msghdr writing after brcmf_msgbuf_remove_flowring. Host driver should delete flowring after txflow complete and all txstatus back, or pend_8021x_cnt will never be zero and cause every connection 950 milliseconds(MAX_WAIT_FOR_8021X_TX) delay. Signed-off-by: Wright Feng Signed-off-by: Chi-hsien Lin Signed-off-by: Ahmad Fatoum Signed-off-by: Alvin Šipraga --- .../broadcom/brcm80211/brcmfmac/core.c | 4 +++- .../broadcom/brcm80211/brcmfmac/msgbuf.c | 23 ++++++++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c index 87aef211b35f..8ca259ace001 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/core.c @@ -1484,8 +1484,10 @@ int brcmf_netdev_wait_pend8021x(struct brcmf_if *ifp) !brcmf_get_pend_8021x_cnt(ifp), MAX_WAIT_FOR_8021X_TX); - if (!err) + if (!err) { bphy_err(drvr, "Timed out waiting for no pending 802.1x packets\n"); + atomic_set(&ifp->pend_8021x_cnt, 0); + } return !err; } diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c index b2d0f7570aa9..174584b42972 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c @@ -71,6 +71,7 @@ #define BRCMF_MSGBUF_TRICKLE_TXWORKER_THRS 32 #define BRCMF_MSGBUF_UPDATE_RX_PTR_THRS 48 +#define BRCMF_MAX_TXSTATUS_WAIT_RETRIES 10 struct msgbuf_common_hdr { u8 msgtype; @@ -806,8 +807,12 @@ static int brcmf_msgbuf_tx_queue_data(struct brcmf_pub *drvr, int ifidx, flowid = brcmf_flowring_lookup(flow, eh->h_dest, skb->priority, ifidx); if (flowid == BRCMF_FLOWRING_INVALID_ID) { flowid = brcmf_msgbuf_flowring_create(msgbuf, ifidx, skb); - if (flowid == BRCMF_FLOWRING_INVALID_ID) + if (flowid == BRCMF_FLOWRING_INVALID_ID) { return -ENOMEM; + } else { + brcmf_flowring_enqueue(flow, flowid, skb); + return 0; + } } queue_count = brcmf_flowring_enqueue(flow, flowid, skb); force = ((queue_count % BRCMF_MSGBUF_TRICKLE_TXWORKER_THRS) == 0); @@ -1395,9 +1400,25 @@ void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u16 flowid) struct brcmf_msgbuf *msgbuf = (struct brcmf_msgbuf *)drvr->proto->pd; struct msgbuf_tx_flowring_delete_req *delete; struct brcmf_commonring *commonring; + struct brcmf_commonring *commonring_del; + void *ret_ptr; u8 ifidx; int err; + int retry = BRCMF_MAX_TXSTATUS_WAIT_RETRIES; + + /* wait for commonring txflow finished */ + commonring_del = msgbuf->flowrings[flowid]; + brcmf_commonring_lock(commonring_del); + while (retry && atomic_read(&commonring_del->outstanding_tx)) { + usleep_range(5000, 10000); + retry--; + } + brcmf_commonring_unlock(commonring_del); + if (!retry && atomic_read(&commonring_del->outstanding_tx)) { + brcmf_err("timed out waiting for txstatus\n"); + atomic_set(&commonring_del->outstanding_tx, 0); + } /* no need to submit if firmware can not be reached */ if (drvr->bus_if->state != BRCMF_BUS_UP) { From patchwork Fri Jul 22 11:56:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alvin_=C5=A0ipraga?= X-Patchwork-Id: 12926411 X-Patchwork-Delegate: kuba@kernel.org 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 B9340CCA47F for ; Fri, 22 Jul 2022 11:57:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235055AbiGVL5J (ORCPT ); Fri, 22 Jul 2022 07:57:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234580AbiGVL4y (ORCPT ); Fri, 22 Jul 2022 07:56:54 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 788A6B5054 for ; Fri, 22 Jul 2022 04:56:53 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id r6so5531208edd.7 for ; Fri, 22 Jul 2022 04:56:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pqrs.dk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ByHDj6/WZNLvf+U8I4CMzhK6/AcSzDl8NnQYMdbCHC0=; b=FSMwh2vz58WxOv5apuHGTlYbe8dQNKcB8eRfB22RfKdiB3t/ALd2FrPamvdCAh0gbW OQwuReunohVucJw3yYODEQzuMUfykVnM1DMctWhXxEwmPfXTgRhkb2h2lhnojwZ6i9YH 1nCNf7qLZ4/MiX9uPvfYxBjXPafrojGA14pgY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ByHDj6/WZNLvf+U8I4CMzhK6/AcSzDl8NnQYMdbCHC0=; b=jyKSuU8LnH2rbA8UCTO9ULsXmLGs45Q+m9JV4tL4sCy6BUR9WuyHUTJCc4QQ1QhzWl Tvl0AMrDbtwi3HkbQcCwo9Hg16KhkLgLI37lQ4MUQZlgWHwg8RXT8LcWt6MjNeNgRF9/ 2B6d7XnCvXH0iETVoqtvr0KTJ1c/d976mnhG6wN397ImBaXYMEil/b8WqcRPN4CUL8L8 IpXjNLYByCpZ2K2XRWiXI1W8zm/6LaGL/Q6owP/31iy9bRpo3uZx3f26UgPK1isZQUhR aQvp7lwzQq/+zQYZWzd/UYTlcjh6RYtW896PwLT11wmFVMrZoA7GbMsHpdzJz3pz/pKC bKpw== X-Gm-Message-State: AJIora+EypyHVnNxTPe7Hm3V5Kj/WCkWyMiBnVUefgd83m9Dn/11WKs3 owf5qCP0t1D3Usfz6scSIhZczA== X-Google-Smtp-Source: AGRyM1vdGX0KozqUPHlKamS+jAQgi2PQ56UFeun3hPwIAEyV6QaNxCMTDCsIu960lsOqlMxNsia4dA== X-Received: by 2002:a05:6402:444c:b0:43b:d375:e932 with SMTP id o12-20020a056402444c00b0043bd375e932mr226594edb.399.1658491011990; Fri, 22 Jul 2022 04:56:51 -0700 (PDT) Received: from localhost.localdomain (80.71.142.18.ipv4.parknet.dk. [80.71.142.18]) by smtp.gmail.com with ESMTPSA id kx6-20020a170907774600b0072b3182368fsm1934370ejc.77.2022.07.22.04.56.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Jul 2022 04:56:51 -0700 (PDT) From: =?utf-8?q?Alvin_=C5=A0ipraga?= To: Arend van Spriel , Franky Lin , Hante Meuleman , Kalle Valo , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Wright Feng , Chi-Hsien Lin , Ahmad Fatoum , =?utf-8?q?Alvin_=C5=A0ipraga?= , linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, SHA-cyfmac-dev-list@infineon.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/6] brcmfmac: fix scheduling while atomic issue when deleting flowring Date: Fri, 22 Jul 2022 13:56:27 +0200 Message-Id: <20220722115632.620681-3-alvin@pqrs.dk> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220722115632.620681-1-alvin@pqrs.dk> References: <20220722115632.620681-1-alvin@pqrs.dk> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Wright Feng We should not sleep while holding the spin lock. It makes 'scheduling while atomic' in brcmf_msgbuf_delete_flowring. And to avoid race condition between deleting flowring and txflow, we only hold spin lock when seting flowring status to RING_CLOSING. Signed-off-by: Wright Feng Signed-off-by: Chi-Hsien Lin Signed-off-by: Ahmad Fatoum Signed-off-by: Alvin Šipraga --- .../broadcom/brcm80211/brcmfmac/flowring.c | 5 +---- .../wireless/broadcom/brcm80211/brcmfmac/msgbuf.c | 14 ++++++++------ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c index 096f6b969dd8..e1127d7e086d 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/flowring.c @@ -419,7 +419,6 @@ void brcmf_flowring_configure_addr_mode(struct brcmf_flowring *flow, int ifidx, flowid = flow->hash[i].flowid; if (flow->rings[flowid]->status != RING_OPEN) continue; - flow->rings[flowid]->status = RING_CLOSING; brcmf_msgbuf_delete_flowring(drvr, flowid); } } @@ -458,10 +457,8 @@ void brcmf_flowring_delete_peer(struct brcmf_flowring *flow, int ifidx, if ((sta || (memcmp(hash[i].mac, peer, ETH_ALEN) == 0)) && (hash[i].ifidx == ifidx)) { flowid = flow->hash[i].flowid; - if (flow->rings[flowid]->status == RING_OPEN) { - flow->rings[flowid]->status = RING_CLOSING; + if (flow->rings[flowid]->status == RING_OPEN) brcmf_msgbuf_delete_flowring(drvr, flowid); - } } } diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c index 174584b42972..cec53f934940 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/msgbuf.c @@ -1400,22 +1400,24 @@ void brcmf_msgbuf_delete_flowring(struct brcmf_pub *drvr, u16 flowid) struct brcmf_msgbuf *msgbuf = (struct brcmf_msgbuf *)drvr->proto->pd; struct msgbuf_tx_flowring_delete_req *delete; struct brcmf_commonring *commonring; - struct brcmf_commonring *commonring_del; - + struct brcmf_commonring *commonring_del = msgbuf->flowrings[flowid]; + struct brcmf_flowring *flow = msgbuf->flow; void *ret_ptr; u8 ifidx; int err; int retry = BRCMF_MAX_TXSTATUS_WAIT_RETRIES; - /* wait for commonring txflow finished */ - commonring_del = msgbuf->flowrings[flowid]; + /* make sure it is not in txflow */ brcmf_commonring_lock(commonring_del); + flow->rings[flowid]->status = RING_CLOSING; + brcmf_commonring_unlock(commonring_del); + + /* wait for commonring txflow finished */ while (retry && atomic_read(&commonring_del->outstanding_tx)) { usleep_range(5000, 10000); retry--; } - brcmf_commonring_unlock(commonring_del); - if (!retry && atomic_read(&commonring_del->outstanding_tx)) { + if (!retry) { brcmf_err("timed out waiting for txstatus\n"); atomic_set(&commonring_del->outstanding_tx, 0); } From patchwork Fri Jul 22 11:56:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alvin_=C5=A0ipraga?= X-Patchwork-Id: 12926407 X-Patchwork-Delegate: kuba@kernel.org 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 08F90C43334 for ; Fri, 22 Jul 2022 11:57:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234932AbiGVL47 (ORCPT ); Fri, 22 Jul 2022 07:56:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52488 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234966AbiGVL45 (ORCPT ); Fri, 22 Jul 2022 07:56:57 -0400 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2CDC9D516 for ; Fri, 22 Jul 2022 04:56:55 -0700 (PDT) Received: by mail-ej1-x62e.google.com with SMTP id va17so8248399ejb.0 for ; Fri, 22 Jul 2022 04:56:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pqrs.dk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Q/6C0hLMVNU55CHBk2mKAQizRq+SuLOg1CztoKY0K0w=; b=BEVYIA0lnjGN1trnUmc0Ud1yyrhMRF7BQCNGY1RZGWN2aF7yCiMNOW3Nn0X7V6OP8w G1nzBWscScxUURnwYrZrEs6o+haNY6jjbg+81D8L0NEtqxfKYf5K872HphS/EXDSdKUk p8I42JuSTAq8FDHTdMhRq9VMskh/l+4vJYz9Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Q/6C0hLMVNU55CHBk2mKAQizRq+SuLOg1CztoKY0K0w=; b=SliiMjTjo0/eIeoZyMEznZpkZPTEKR5K0D6xhO9EvdaEqogxcHmUvt3vBlg9IuL+1e Rcy5zLh6KpwhPB+MgS6T0kn/CysoU1zwh2OUOzyUcTmbvxfLBYIu2yjbmn/LetFYr445 z2Wly/fHl9Bi1l0wyiwNgrmoknVmGX15VUmZFLtalfuC+rQK5ocjll+TIkR4eNqqWAu1 O6w7FZt7Nt34/8OTHJ9bSXqYkDjwG6EEzhMMIzopMZzET3IdzD6Q+DpXVuAgH9aK8F1k TnqEyjtK25rXSdbEE7SgKaJ13zc9mYz41zCfdcfd4DVvlsH98ieVXwqlm/Jl2Gpff28A pY8Q== X-Gm-Message-State: AJIora95kfzwqm9rwOLA8HdyER0rDWozqW0Nr6EihF0aOsm2HNC991hA ZP5R71mtloJluvd81r2iJQpLJA== X-Google-Smtp-Source: AGRyM1uej07WP45uDK4ei4EmPhnABupcSWVKvAJ6snuX+mhlQSBrIveS1JVNXAIWbkE7EBLQ2EpEzA== X-Received: by 2002:a17:907:d92:b0:72e:e968:7fa1 with SMTP id go18-20020a1709070d9200b0072ee9687fa1mr160432ejc.731.1658491014160; Fri, 22 Jul 2022 04:56:54 -0700 (PDT) Received: from localhost.localdomain (80.71.142.18.ipv4.parknet.dk. [80.71.142.18]) by smtp.gmail.com with ESMTPSA id kx6-20020a170907774600b0072b3182368fsm1934370ejc.77.2022.07.22.04.56.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Jul 2022 04:56:53 -0700 (PDT) From: =?utf-8?q?Alvin_=C5=A0ipraga?= To: Arend van Spriel , Franky Lin , Hante Meuleman , Kalle Valo , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Wright Feng , Chi-hsien Lin , Ahmad Fatoum , =?utf-8?q?Alvin_=C5=A0ipraga?= , linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, SHA-cyfmac-dev-list@infineon.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/6] brcmfmac: fix invalid address access when enabling SCAN log level Date: Fri, 22 Jul 2022 13:56:28 +0200 Message-Id: <20220722115632.620681-4-alvin@pqrs.dk> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220722115632.620681-1-alvin@pqrs.dk> References: <20220722115632.620681-1-alvin@pqrs.dk> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Wright Feng The variable i is changed when setting random MAC address and causes invalid address access when printing the value of pi->reqs[i]->reqid. We replace reqs index with ri to fix the issue. [ 136.726473] Unable to handle kernel access to user memory outside uaccess routines at virtual address 0000000000000000 [ 136.737365] Mem abort info: [ 136.740172] ESR = 0x96000004 [ 136.743359] Exception class = DABT (current EL), IL = 32 bits [ 136.749294] SET = 0, FnV = 0 [ 136.752481] EA = 0, S1PTW = 0 [ 136.755635] Data abort info: [ 136.758514] ISV = 0, ISS = 0x00000004 [ 136.762487] CM = 0, WnR = 0 [ 136.765522] user pgtable: 4k pages, 48-bit VAs, pgdp = 000000005c4e2577 [ 136.772265] [0000000000000000] pgd=0000000000000000 [ 136.777160] Internal error: Oops: 96000004 [#1] PREEMPT SMP [ 136.782732] Modules linked in: brcmfmac(O) brcmutil(O) cfg80211(O) compat(O) [ 136.789788] Process wificond (pid: 3175, stack limit = 0x00000000053048fb) [ 136.796664] CPU: 3 PID: 3175 Comm: wificond Tainted: G O 4.19.42-00001-g531a5f5 #1 [ 136.805532] Hardware name: Freescale i.MX8MQ EVK (DT) [ 136.810584] pstate: 60400005 (nZCv daif +PAN -UAO) [ 136.815429] pc : brcmf_pno_config_sched_scans+0x6cc/0xa80 [brcmfmac] [ 136.821811] lr : brcmf_pno_config_sched_scans+0x67c/0xa80 [brcmfmac] [ 136.828162] sp : ffff00000e9a3880 [ 136.831475] x29: ffff00000e9a3890 x28: ffff800020543400 [ 136.836786] x27: ffff8000b1008880 x26: ffff0000012bf6a0 [ 136.842098] x25: ffff80002054345c x24: ffff800088d22400 [ 136.847409] x23: ffff0000012bf638 x22: ffff0000012bf6d8 [ 136.852721] x21: ffff8000aced8fc0 x20: ffff8000ac164400 [ 136.858032] x19: ffff00000e9a3946 x18: 0000000000000000 [ 136.863343] x17: 0000000000000000 x16: 0000000000000000 [ 136.868655] x15: ffff0000093f3b37 x14: 0000000000000050 [ 136.873966] x13: 0000000000003135 x12: 0000000000000000 [ 136.879277] x11: 0000000000000000 x10: ffff000009a61888 [ 136.884589] x9 : 000000000000000f x8 : 0000000000000008 [ 136.889900] x7 : 303a32303d726464 x6 : ffff00000a1f957d [ 136.895211] x5 : 0000000000000000 x4 : ffff00000e9a3942 [ 136.900523] x3 : 0000000000000000 x2 : ffff0000012cead8 [ 136.905834] x1 : ffff0000012bf6d8 x0 : 0000000000000000 [ 136.911146] Call trace: [ 136.913623] brcmf_pno_config_sched_scans+0x6cc/0xa80 [brcmfmac] [ 136.919658] brcmf_pno_start_sched_scan+0xa4/0x118 [brcmfmac] [ 136.925430] brcmf_cfg80211_sched_scan_start+0x80/0xe0 [brcmfmac] [ 136.931636] nl80211_start_sched_scan+0x140/0x308 [cfg80211] [ 136.937298] genl_rcv_msg+0x358/0x3f4 [ 136.940960] netlink_rcv_skb+0xb4/0x118 [ 136.944795] genl_rcv+0x34/0x48 [ 136.947935] netlink_unicast+0x264/0x300 [ 136.951856] netlink_sendmsg+0x2e4/0x33c [ 136.955781] __sys_sendto+0x120/0x19c Signed-off-by: Wright Feng Signed-off-by: Chi-hsien Lin Signed-off-by: Ahmad Fatoum Signed-off-by: Alvin Šipraga --- .../net/wireless/broadcom/brcm80211/brcmfmac/pno.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c index fabfbb0b40b0..d0a7465be586 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pno.c @@ -158,12 +158,12 @@ static int brcmf_pno_set_random(struct brcmf_if *ifp, struct brcmf_pno_info *pi) struct brcmf_pno_macaddr_le pfn_mac; u8 *mac_addr = NULL; u8 *mac_mask = NULL; - int err, i; + int err, i, ri; - for (i = 0; i < pi->n_reqs; i++) - if (pi->reqs[i]->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { - mac_addr = pi->reqs[i]->mac_addr; - mac_mask = pi->reqs[i]->mac_addr_mask; + for (ri = 0; ri < pi->n_reqs; ri++) + if (pi->reqs[ri]->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) { + mac_addr = pi->reqs[ri]->mac_addr; + mac_mask = pi->reqs[ri]->mac_addr_mask; break; } @@ -185,7 +185,7 @@ static int brcmf_pno_set_random(struct brcmf_if *ifp, struct brcmf_pno_info *pi) pfn_mac.mac[0] |= 0x02; brcmf_dbg(SCAN, "enabling random mac: reqid=%llu mac=%pM\n", - pi->reqs[i]->reqid, pfn_mac.mac); + pi->reqs[ri]->reqid, pfn_mac.mac); err = brcmf_fil_iovar_data_set(ifp, "pfn_macaddr", &pfn_mac, sizeof(pfn_mac)); if (err) From patchwork Fri Jul 22 11:56:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alvin_=C5=A0ipraga?= X-Patchwork-Id: 12926408 X-Patchwork-Delegate: kuba@kernel.org 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 75283C43334 for ; Fri, 22 Jul 2022 11:57:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235061AbiGVL5C (ORCPT ); Fri, 22 Jul 2022 07:57:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234867AbiGVL46 (ORCPT ); Fri, 22 Jul 2022 07:56:58 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C94A5BB212 for ; Fri, 22 Jul 2022 04:56:56 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id r6so5531411edd.7 for ; Fri, 22 Jul 2022 04:56:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pqrs.dk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=03MRB+asuYHEWRjNWyWQYFq+NaD83n6aClneexveW8M=; b=VtV9tIueqyAIzh5ghN54ab7O0Qjq2qjh7hr5zpWjHFAwQ9wiO7A7x/9R0KEbP9LdqX Q/dRZ2DZbJ3q3fEbKtD/jF3a1Fz80ErXsw4xQSOgo6ORVUpz+QUSYsxmTeHMVWZY9WWy eQBF6of88Gv+pBG2dxc+C3lGk8EvKN8CEt4BA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=03MRB+asuYHEWRjNWyWQYFq+NaD83n6aClneexveW8M=; b=f5+qq9dUj3cOg1Anpgx1hdrO5Wel3vWPbvYAsRhhBkM2knwZrJ1aJoqPeafUc0goFw Jnw62OjoYE4ZylYjEeN+WyfdgxONZ1LT7V+h75KmiuwOaqIIwUUyi5XZoVdl6vtaDqAi zU+rSpwWIonkyhapLqzItOHUtK0u6BeiVrsS1ufWPLBAQT0hJxfYiE0V+ePcN6veNAmi zAByHfmGK9mWC8Aac+w9laObQv5oQGsYZ5iZdHCMGnGx6YUpn/9K8FOY3v2AgxvRtaiq 6nQhHD/cXny/X9hVtR086DLywErSLJqgnvTLlCDmxIyOEmNVlBo8Gk8ToChARQk3or2S AbBQ== X-Gm-Message-State: AJIora+ctGQzhr7BiDSY95eG3IMdQI8OmQRGAXvBuBnrdpVB47pgb849 ocu4ZSyyoKDYuRkfuJRqU+qY9A== X-Google-Smtp-Source: AGRyM1tuKPZ19wuvTpZlTKmC8A4+UWEmcvUJCyz7kl2ifrZUs11Q1Rg0a8nm4Kr9s2T0q6nxu3Khug== X-Received: by 2002:a05:6402:11cb:b0:43a:b592:efbb with SMTP id j11-20020a05640211cb00b0043ab592efbbmr248964edw.157.1658491016413; Fri, 22 Jul 2022 04:56:56 -0700 (PDT) Received: from localhost.localdomain (80.71.142.18.ipv4.parknet.dk. [80.71.142.18]) by smtp.gmail.com with ESMTPSA id kx6-20020a170907774600b0072b3182368fsm1934370ejc.77.2022.07.22.04.56.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Jul 2022 04:56:56 -0700 (PDT) From: =?utf-8?q?Alvin_=C5=A0ipraga?= To: Arend van Spriel , Franky Lin , Hante Meuleman , Kalle Valo , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Wataru Gohda , Chi-hsien Lin , Ahmad Fatoum , =?utf-8?q?Alvin_=C5=A0ipraga?= , linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, SHA-cyfmac-dev-list@infineon.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/6] brcmfmac: Fix to add brcmf_clear_assoc_ies when rmmod Date: Fri, 22 Jul 2022 13:56:29 +0200 Message-Id: <20220722115632.620681-5-alvin@pqrs.dk> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220722115632.620681-1-alvin@pqrs.dk> References: <20220722115632.620681-1-alvin@pqrs.dk> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Wataru Gohda Conn_info->req_ie/resp_ie is used to indicate the assoc_req_ies / assoc_resp_ies to cfg80211 layer when connection is done. The buffer is freed and allocated again at next connection establishment. The buffers also needs to be freed at the timing of rmmod as well. Signed-off-by: Wataru Gohda Signed-off-by: Chi-hsien Lin Signed-off-by: Ahmad Fatoum Signed-off-by: Alvin Šipraga --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c index 605206abe424..6ef574d69755 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c @@ -6429,6 +6429,7 @@ static void wl_deinit_priv(struct brcmf_cfg80211_info *cfg) cfg->dongle_up = false; /* dongle down */ brcmf_abort_scanning(cfg); brcmf_deinit_priv_mem(cfg); + brcmf_clear_assoc_ies(cfg); } static void init_vif_event(struct brcmf_cfg80211_vif_event *event) From patchwork Fri Jul 22 11:56:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alvin_=C5=A0ipraga?= X-Patchwork-Id: 12926409 X-Patchwork-Delegate: kuba@kernel.org 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 F2CD6C43334 for ; Fri, 22 Jul 2022 11:57:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234605AbiGVL5F (ORCPT ); Fri, 22 Jul 2022 07:57:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235007AbiGVL5C (ORCPT ); Fri, 22 Jul 2022 07:57:02 -0400 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 186DA9D1F9 for ; Fri, 22 Jul 2022 04:57:00 -0700 (PDT) Received: by mail-ed1-x532.google.com with SMTP id t3so5598949edd.0 for ; Fri, 22 Jul 2022 04:56:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pqrs.dk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=flnEvotZidaUh2ykk93snCPMpbwPpMdDiRUs0F6eFEc=; b=Z6SfeP8zsYcJua2iTIQeZidzdyHntaXwsRbowZ7wR2rGGaujqr2+mDU88XYuiwUBD/ bNxPs/fLEpfyBMPa42WlZXmp2Nslb7bqnMpqo70+FQBVckDSgAhrA6PVgtnBV+V75ane 6vvH1huOD+yEuf8CiQ1EQSX/rYqyYpAZaLH1I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=flnEvotZidaUh2ykk93snCPMpbwPpMdDiRUs0F6eFEc=; b=Sr+GMUH7LvYeeo7t13PdxuR1McRnlcfYwHPebq2VPDUp7UxDb/7u+NcNMLkSa+6nYB e/8zuWEdf5gYe7wQUye933YIBycRrkzCyL62/wAyQxxQri+nTNwR+x7LfVNF5gC8SMef vD0YrBNgopNKF61hwUV+8W593nQXNNAcXf7rz+5xYA5OMrn7pIOj8vAF1TiFapEO03T5 J9V/t5pHNzMABNMwoie9KwW/ozg1NSOGPJlEx1ZR+AJCqmHR3rzZGlEewnG3SAbXHqkE yr854gQbh9qHBwy5CMLbPl3ciRa3XLxuRSiq5gmDb77OqmQ5GwQKIAsoujzKE/zEwLHp hqaw== X-Gm-Message-State: AJIora8ejqhSeg1dTenYwK8Q0lWEVI/flJrr2ytLsvMCWDLkN5RHFwpw f7QmYJDmI2Lz3cKerTchqdqDew== X-Google-Smtp-Source: AGRyM1vURj2VAwzGo07/a5qNyG8Qpq1IH/QMoTDEVKfcuwz69Cs5aCxc6iH2rOLcwmbtCV9HVOtKUQ== X-Received: by 2002:a05:6402:2789:b0:43a:de54:40fd with SMTP id b9-20020a056402278900b0043ade5440fdmr234482ede.319.1658491018561; Fri, 22 Jul 2022 04:56:58 -0700 (PDT) Received: from localhost.localdomain (80.71.142.18.ipv4.parknet.dk. [80.71.142.18]) by smtp.gmail.com with ESMTPSA id kx6-20020a170907774600b0072b3182368fsm1934370ejc.77.2022.07.22.04.56.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Jul 2022 04:56:58 -0700 (PDT) From: =?utf-8?q?Alvin_=C5=A0ipraga?= To: Arend van Spriel , Franky Lin , Hante Meuleman , Kalle Valo , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Wataru Gohda , Chi-hsien Lin , Ahmad Fatoum , =?utf-8?q?Alvin_=C5=A0ipraga?= , linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, SHA-cyfmac-dev-list@infineon.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/6] brcmfmac: Fix to add skb free for TIM update info when tx is completed Date: Fri, 22 Jul 2022 13:56:30 +0200 Message-Id: <20220722115632.620681-6-alvin@pqrs.dk> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220722115632.620681-1-alvin@pqrs.dk> References: <20220722115632.620681-1-alvin@pqrs.dk> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Wataru Gohda The skb will be allocated to send TIM update info in brcmf_fws_tim_update. Currently the skb will be freed when tx is failed but it will not be freed when tx is completed successfully. The fix is to free the skb when tx is completed always. Signed-off-by: Wataru Gohda Signed-off-by: Chi-hsien Lin Signed-off-by: Ahmad Fatoum Signed-off-by: Alvin Šipraga --- .../wireless/broadcom/brcm80211/brcmfmac/bcdc.c | 3 +-- .../broadcom/brcm80211/brcmfmac/fwsignal.c | 16 ++++++++++------ .../broadcom/brcm80211/brcmfmac/fwsignal.h | 3 ++- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c index 2c95a08a5871..02a56edf08ba 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcdc.c @@ -368,8 +368,7 @@ brcmf_proto_bcdc_txcomplete(struct device *dev, struct sk_buff *txp, /* await txstatus signal for firmware if active */ if (brcmf_fws_fc_active(bcdc->fws)) { - if (!success) - brcmf_fws_bustxfail(bcdc->fws, txp); + brcmf_fws_bustxcomplete(bcdc->fws, txp, success); } else { if (brcmf_proto_bcdc_hdrpull(bus_if->drvr, false, txp, &ifp)) brcmu_pkt_buf_free_skb(txp); diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c index d58525ebe618..85e3b953b0a9 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.c @@ -2475,7 +2475,8 @@ bool brcmf_fws_fc_active(struct brcmf_fws_info *fws) return fws->fcmode != BRCMF_FWS_FCMODE_NONE; } -void brcmf_fws_bustxfail(struct brcmf_fws_info *fws, struct sk_buff *skb) +void brcmf_fws_bustxcomplete(struct brcmf_fws_info *fws, struct sk_buff *skb, + bool success) { u32 hslot; @@ -2483,11 +2484,14 @@ void brcmf_fws_bustxfail(struct brcmf_fws_info *fws, struct sk_buff *skb) brcmu_pkt_buf_free_skb(skb); return; } - brcmf_fws_lock(fws); - hslot = brcmf_skb_htod_tag_get_field(skb, HSLOT); - brcmf_fws_txs_process(fws, BRCMF_FWS_TXSTATUS_HOST_TOSSED, hslot, 0, 0, - 1); - brcmf_fws_unlock(fws); + + if (!success) { + brcmf_fws_lock(fws); + hslot = brcmf_skb_htod_tag_get_field(skb, HSLOT); + brcmf_fws_txs_process(fws, BRCMF_FWS_TXSTATUS_HOST_TOSSED, hslot, + 0, 0, 1); + brcmf_fws_unlock(fws); + } } void brcmf_fws_bus_blocked(struct brcmf_pub *drvr, bool flow_blocked) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.h index b16a9d1c0508..f9c36cd8f1de 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwsignal.h @@ -40,7 +40,8 @@ int brcmf_fws_process_skb(struct brcmf_if *ifp, struct sk_buff *skb); void brcmf_fws_reset_interface(struct brcmf_if *ifp); void brcmf_fws_add_interface(struct brcmf_if *ifp); void brcmf_fws_del_interface(struct brcmf_if *ifp); -void brcmf_fws_bustxfail(struct brcmf_fws_info *fws, struct sk_buff *skb); +void brcmf_fws_bustxcomplete(struct brcmf_fws_info *fws, struct sk_buff *skb, + bool success); void brcmf_fws_bus_blocked(struct brcmf_pub *drvr, bool flow_blocked); void brcmf_fws_rxreorder(struct brcmf_if *ifp, struct sk_buff *skb); From patchwork Fri Jul 22 11:56:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alvin_=C5=A0ipraga?= X-Patchwork-Id: 12926410 X-Patchwork-Delegate: kuba@kernel.org 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 6C15BC433EF for ; Fri, 22 Jul 2022 11:57:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234930AbiGVL5H (ORCPT ); Fri, 22 Jul 2022 07:57:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235091AbiGVL5E (ORCPT ); Fri, 22 Jul 2022 07:57:04 -0400 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38E96BB221 for ; Fri, 22 Jul 2022 04:57:02 -0700 (PDT) Received: by mail-ed1-x536.google.com with SMTP id t3so5599046edd.0 for ; Fri, 22 Jul 2022 04:57:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pqrs.dk; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kU972/Ti7378lz0X9ZqJvIJG14FXu8vb+YycDZtlNEs=; b=iaadc3k9Vb0dBlWleTRhgOHE6k6K/BUKoYvG4LQcVV5ajYnFAsC+LpC+Jc7o4B1pEq u+KUMNvcKJHB/o5l8QuMtG6FOxGNQQR0mQQ5F32d2TcNcjPwp5St9bqUvHzzyH+8Ojfm 5iMygMxWNc2uhYkJPOjE07sglSlOJO4tJzwHw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kU972/Ti7378lz0X9ZqJvIJG14FXu8vb+YycDZtlNEs=; b=gsCO5JfP3xviH/8p1U7rLs8MqS183/q5tLSZUv1gZkG3DGpvNQPixxieGgASJgPYjM Fj/6PTyBQbWdboNu0591kZ32IqqOwH22h2ckXsTskUXzcfihqmp7V9kbmUaJiINfr2WG ZK7sg6jSMcMcOsOVtqYHou2HK+D8miFqOHoIFCKB6LcoiY86IVePdikpW3sUz0mfAsPu cBfwtzNdSO5YmBH4vWa5QKaRGwG1Er7n5Mz9N7nLYmijoOkPzxghioSxa0ufNaektH3Z dv6DK9RGR6Tjw2Xxn8oIH8DmKtFnJBPsZNflyp3qRPoWmsYALA1vsssa9mvbCcx+I7Zr HjPA== X-Gm-Message-State: AJIora/CMq5N4prFaYT1xcn1p1MxJKuMkqBDozI2S9z2+cjxXgyEJd8T J4l8D4XkRIsmWWDMrHIHKsmoBA== X-Google-Smtp-Source: AGRyM1tuL1bHSScV4f4fqZVhdg/E7QN0gNWIb72aJ2UbGFtkvUR7uX3cE6hTDLBcuW8sfvGiGSW3FQ== X-Received: by 2002:a05:6402:48c:b0:43a:8bc7:f440 with SMTP id k12-20020a056402048c00b0043a8bc7f440mr297826edv.8.1658491020686; Fri, 22 Jul 2022 04:57:00 -0700 (PDT) Received: from localhost.localdomain (80.71.142.18.ipv4.parknet.dk. [80.71.142.18]) by smtp.gmail.com with ESMTPSA id kx6-20020a170907774600b0072b3182368fsm1934370ejc.77.2022.07.22.04.56.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Jul 2022 04:57:00 -0700 (PDT) From: =?utf-8?q?Alvin_=C5=A0ipraga?= To: Arend van Spriel , Franky Lin , Hante Meuleman , Kalle Valo , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni Cc: Syed Rafiuddeen , Syed Rafiuddeen , Chung-Hsien Hsu , Chi-hsien Lin , =?utf-8?q?Alvin_=C5=A0ipraga?= , linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, SHA-cyfmac-dev-list@infineon.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 6/6] brcmfmac: Update SSID of hidden AP while informing its bss to cfg80211 layer Date: Fri, 22 Jul 2022 13:56:31 +0200 Message-Id: <20220722115632.620681-7-alvin@pqrs.dk> X-Mailer: git-send-email 2.37.0 In-Reply-To: <20220722115632.620681-1-alvin@pqrs.dk> References: <20220722115632.620681-1-alvin@pqrs.dk> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Syed Rafiuddeen cfg80211 layer on DUT STA is disconnecting ongoing connection attempt after receiving association response, because cfg80211 layer does not have valid AP bss information. On association response event, brcmfmac communicates the AP bss information to cfg80211 layer, but SSID seem to be empty in AP bss information, and cfg80211 layer prints kernel warning and then disconnects the ongoing connection attempt. SSID is empty in SSID IE, but 'bi->SSID' contains a valid SSID, so updating the SSID for hidden AP while informing its bss information to cfg80211 layer. Signed-off-by: Syed Rafiuddeen Signed-off-by: Chung-Hsien Hsu Signed-off-by: Chi-hsien Lin Signed-off-by: Alvin Šipraga --- .../net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c index 6ef574d69755..d6127b855060 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/cfg80211.c @@ -2989,6 +2989,7 @@ static s32 brcmf_inform_single_bss(struct brcmf_cfg80211_info *cfg, u8 *notify_ie; size_t notify_ielen; struct cfg80211_inform_bss bss_data = {}; + const struct brcmf_tlv *ssid = NULL; if (le32_to_cpu(bi->length) > WL_BSS_INFO_MAX) { bphy_err(drvr, "Bss info is larger than buffer. Discarding\n"); @@ -3018,6 +3019,12 @@ static s32 brcmf_inform_single_bss(struct brcmf_cfg80211_info *cfg, notify_ielen = le32_to_cpu(bi->ie_length); bss_data.signal = (s16)le16_to_cpu(bi->RSSI) * 100; + ssid = brcmf_parse_tlvs(notify_ie, notify_ielen, WLAN_EID_SSID); + if (ssid && ssid->data[0] == '\0' && ssid->len == bi->SSID_len) { + /* Update SSID for hidden AP */ + memcpy((u8 *)ssid->data, bi->SSID, bi->SSID_len); + } + brcmf_dbg(CONN, "bssid: %pM\n", bi->BSSID); brcmf_dbg(CONN, "Channel: %d(%d)\n", channel, freq); brcmf_dbg(CONN, "Capability: %X\n", notify_capability);