From patchwork Wed Sep 27 16:32:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= X-Patchwork-Id: 145611 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp2925525vqu; Wed, 27 Sep 2023 15:04:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHpn9L8DzIgyErnTMiDcp1J99Tsnh94lvO4Ew5y95cQqm1TBpBMIoQ+THRKDJcGAHjU2HPQ X-Received: by 2002:a05:6a20:1607:b0:15a:7d2:a418 with SMTP id l7-20020a056a20160700b0015a07d2a418mr5325132pzj.19.1695852295071; Wed, 27 Sep 2023 15:04:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1695852295; cv=pass; d=google.com; s=arc-20160816; b=RZyV4z7PY7J7NxJoW9zfgub08Rdm7mTkeRtRBqeeeGUmqY5swuoOhsg5LEKc1JdDZh NRgPX7E1P6Iq3dK3+Ef9le5i81frluYIVmjDwFpxXyDweIJJKzyfqfly8aNEdGgqYyPo T9Ig1N0cLYXE+iwfX5N4Cvc/mRWBl1KOI54WDhIr99UXl/2WkzSczZBOkqMaQcS3CxcO +ChN/LVt+uIghZW0jrRNbkcrjPWAObxdfUOqmjZ0lk9oyj/i/hqp7LolkqAuB/3bGOdF pjPP8gVnmJPDJk2xguchrvpZMIKst/+s59cCLxln3ab5wS2fkoEbBBo/W5TpygUWvVql 5irQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ZPRftwa/5INHUuf/U0IO6DYv07+MkuBCaxGoh+MZ00E=; fh=l0GbbulFVEGIByrdVk2PDAYC0467jisoj0AJEvNmoTE=; b=0xvlzNv9/0Jt79vtjjA+3dmJ/8NzNvpE8UJMN6ZSYsrj+aiRd9yfEHW2r0QSpxZHgu qyTu/6VB1lz8FBaHEx8h0YxuP7jRy2tW0Etqa0d8mE+P5674G1fIJxuvt2IbCvdrdBP8 a9sTJhLPKhXGNV08aoYIldsIhNEqqslsKQwGLoWbvKGhBG5OHeJXIRdDW5sovTR4ea0M m8jg6QmpkRVUqPVwTtcCktaSaGbv5YPgQ/gQtenTtU7eddF5RuRL3vbiJTSr3tyZYJqk 5Y2h+jFmBFzP+VxCVC2taMChaAJwxVhfXYRG2X25ehB8e64Ti2i898Hs8C9QIgNhSGW+ QhLQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@silabs.onmicrosoft.com header.s=selector2-silabs-onmicrosoft-com header.b="MyK/MeGD"; arc=pass (i=1 spf=pass spfdomain=silabs.com dkim=pass dkdomain=silabs.com dmarc=pass fromdomain=silabs.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=silabs.com Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id b132-20020a63348a000000b005787de7abd4si16789592pga.12.2023.09.27.15.04.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 15:04:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@silabs.onmicrosoft.com header.s=selector2-silabs-onmicrosoft-com header.b="MyK/MeGD"; arc=pass (i=1 spf=pass spfdomain=silabs.com dkim=pass dkdomain=silabs.com dmarc=pass fromdomain=silabs.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=silabs.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id BC4548021B32; Wed, 27 Sep 2023 09:35:04 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232100AbjI0Qd6 (ORCPT + 19 others); Wed, 27 Sep 2023 12:33:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231974AbjI0Qdl (ORCPT ); Wed, 27 Sep 2023 12:33:41 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2077.outbound.protection.outlook.com [40.107.93.77]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFE68121; Wed, 27 Sep 2023 09:33:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZG+Lwf0gWOFYub+I9uJ92QnFh4PJl12B9enN7xwx1IKWnh4pXWvNda08qOU1ZdHR6q7cfM5PENehUxT2mJln4tYxvatHSDW7w6WNeRSZDLpQzykCxOFZxKklfmEDcrtAlrr2riGF38Zs45Nmt7oK07Q6gGSCV6cjjWh4KTzpdHCUJA2WEDAn7DX/QgzOxasWiw8vVzLlcWEiGvSazSwySmoZpol9TGJzhD9LUDejdDIFk9M/ml2SLJMdVKQrPBybrwV7K5QqqFhwcoggbjZ0HUw1F+YqkCQ1YQw0PjptEwnl+ziTSJsRlx96RNIrlB9m4g9mmPIqwnNyn/mPUGwc5A== 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=ZPRftwa/5INHUuf/U0IO6DYv07+MkuBCaxGoh+MZ00E=; b=huhkI67tP8M6QtYr1GGcbmD43D/NYKT7XMEh/c5a9+XaNSiCTSRl3otIL1pzAyh4liXAtzMDCX/MiOIUzskb+F+0F35+gvF8/aSNEAYqQq59HeHg7P1R5YJtqzskgs5r5GlMml3WJl7XNPnixe6GyIF4ztmZG3c9NNcqiD9+JM0WgXuI3+YYFNRRP1q2ULa/W/+FZnvRAxNhcggeKX4FB+UxWyz2SNT5Dkew5dmIH664Bkwu0eU93pltjKa/eaQMYNEsG1hfP856YI+w+WHZlXJGjjWdilFZSJXMFccJz534IKoICzW8zwf4quylXmaRcYuhAm81tEry3zKdGQqEhw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=silabs.com; dmarc=pass action=none header.from=silabs.com; dkim=pass header.d=silabs.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=silabs.onmicrosoft.com; s=selector2-silabs-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZPRftwa/5INHUuf/U0IO6DYv07+MkuBCaxGoh+MZ00E=; b=MyK/MeGDc/ayCNLod9IBgQjruHxrPsVfR0fu9XNRwccYQo0MuFs9zVeSKnCtvN3oXDwzbd+aV+IwBDchFYjtJSfcXUN+pByS7RmgZaor4/64PSToOp0vSjsnPscSbclQHDgk13WNx515PV4V1jS8ujLa/EXTBBasrfrvBoTQyp0= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=silabs.com; Received: from IA1PR11MB7773.namprd11.prod.outlook.com (2603:10b6:208:3f0::21) by SA1PR11MB6781.namprd11.prod.outlook.com (2603:10b6:806:25d::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.21; Wed, 27 Sep 2023 16:33:30 +0000 Received: from IA1PR11MB7773.namprd11.prod.outlook.com ([fe80::d6c8:4cb6:2594:d8f3]) by IA1PR11MB7773.namprd11.prod.outlook.com ([fe80::d6c8:4cb6:2594:d8f3%4]) with mapi id 15.20.6813.027; Wed, 27 Sep 2023 16:33:29 +0000 From: =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= To: Kalle Valo Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= Subject: [PATCH v2 9/9] wifi: wfx: fix possible lock-up between scan and Rx filters Date: Wed, 27 Sep 2023 18:32:57 +0200 Message-Id: <20230927163257.568496-10-jerome.pouiller@silabs.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230927163257.568496-1-jerome.pouiller@silabs.com> References: <20230927163257.568496-1-jerome.pouiller@silabs.com> X-ClientProxiedBy: DS7PR06CA0052.namprd06.prod.outlook.com (2603:10b6:8:54::30) To IA1PR11MB7773.namprd11.prod.outlook.com (2603:10b6:208:3f0::21) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: IA1PR11MB7773:EE_|SA1PR11MB6781:EE_ X-MS-Office365-Filtering-Correlation-Id: 592df89b-9209-4b58-126d-08dbbf777b88 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9Y0TzJnRoGnKryoYEcR0dBJuhELdAyCKn+5eiMUFleo+drx4JGpm9c08S80jHxPpFPcE2OrGxssV4hsicojHZ1F+UGM46DZpu36zkczGWW72KhwETC4YuPmRaXgfMh1wH9y9O2VLAsOmLY8B38JQvEFKGvewBQjTPhGej2y/rPMIzP5zfDKyyoi5RBakCTWv/qFTu3ypqmYjGgqmRSoMFj5W39WeFb3kFiUXrzolyUWtDMCYTGLXhPla+nJwXnrvQq0aMcuRQtCZv4iqrDUZvoHHqHZGPrXlIhD1547V5QgBottHX9GDfU3VgMVgOjRho2MT1xGmoptbf1V2pPqDi/2Xk8zEF4Z1tX09vCuZ85HQJrOw0NbGXJiJLi903RWQG33rSYdVHyXdz5/J4xsE/hGaYVrshmb5ihi4Z+bJT7JhvCcZID2B0KB3apEfMTTMFrZAGTlfgK4uCLnF473st84+j7Cy+h9Kn4Ms+mT9kAC+PJ2kNQ+709BKeCH5eIvI1Bbw9PBpwfLo84deatoqZXyD4ntx2FDCutfY/pkCCH6SZOrXEyLBc3Q4bbqaAM7l X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:IA1PR11MB7773.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(366004)(136003)(346002)(39850400004)(376002)(230922051799003)(451199024)(186009)(1800799009)(36756003)(86362001)(8936002)(107886003)(6486002)(8676002)(2906002)(38100700002)(4326008)(6512007)(41300700001)(83380400001)(66556008)(5660300002)(1076003)(66574015)(2616005)(52116002)(6506007)(6916009)(66476007)(66946007)(316002)(478600001)(6666004);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?ohts3UNWHRPixoM6LFupCY1ZcwRn?= =?utf-8?q?0o1u540T+t7m42CFsQeUToVfW1LH7CIc4TCz7HXkHetrul6Z5rfZpYYpFC135opid?= =?utf-8?q?5uFpLsfarxIOjd3hhQLJ4invyhRna1PZkVhJ+KgMDItfdaf3Az6BUtQepNAyKsjwP?= =?utf-8?q?WKkoD5qp3iCWtg5uDibtXs+vWAUrBF2DY+AKxjldRaGfVIZFs8k4XU414HyXQaAQj?= =?utf-8?q?i8s5ptrbXdiQO329w1ggTrhMgvcByMwqyCUY+aHwfWXTcfh3nd0ku0rpX1szzH6pR?= =?utf-8?q?iZ8Xy4kE34FTNxHI82TgNt8r1u0tbhHJDeDa8EdVF3xxSGUoB+kPRCDL2lX/9grZ8?= =?utf-8?q?X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vr9Rv5E+vgHBKK4Va6d0VynQ3FqAUpIbPKazKLIauC4z2b0ZDf/CsVIOkFrJob?= =?utf-8?q?E0MeggnzkGsdm8XjSVxMN77PwSAQk5aZxsEYEhxLqw1iAZwIHVPmdTE8gNNF7/zsQ?= =?utf-8?q?bcozkGRIRQTcL01/37hbNWdMMAPomCfrmKsx3i4Aa1rVLwEhyCMz7EC/HBIPyU557?= =?utf-8?q?HquZIK8OezKJIUA+gIwystkfRnHcZTS4RpvF0yqBEStGbKr5Y2XNjWXg1fWf8iOkP?= =?utf-8?q?mRiVn1u4NZ8WsuGIRLdRhnHuNp8zRU7sQEnd7UUN8mMk8+ZJbbgyhAFp9INm1RMsw?= =?utf-8?q?IZ7Xj/o3jvQizYAlDjMdXGSk5YXYjvYeVt0G1v/IrbSle6YW1LY5rD5R/RaUMytu4?= =?utf-8?q?TliJJirFhu0?= X-OriginatorOrg: silabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 592df89b-9209-4b58-126d-08dbbf777b88 X-MS-Exchange-CrossTenant-AuthSource: IA1PR11MB7773.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Sep 2023 16:33:29.8944 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 54dbd822-5231-4b20-944d-6f4abcd541fb X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: p7i6HnOJC1ZtVIgU1/0k7TZoUapmI6IAlo0coRSVtgucHqhCqn+VqrhNJYWkxI9Iv5FT60VjK/VVrAoQt3ymNg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR11MB6781 X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Wed, 27 Sep 2023 09:35:04 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778230015992635256 X-GMAIL-MSGID: 1778230015992635256 The device ignore the rx filters during the scan operation. wfx_configure_filter() acquires scan_lock to reflect this restriction. However, it is not really necessary since mac80211 don't try to configure Rx filters during scan. However, the things are changing. The scan operation is also used to implement remain-on-channel. In this case, wfx_configure_filter() can be called during the scan. Currently, this scenario generate a delay that end with a timeout in the upper layers. For the final user, some scenario of the EasyConnect specification end with a failure. So, avoid acquiring the scan_lock and just return. Signed-off-by: Jérôme Pouiller --- drivers/net/wireless/silabs/wfx/sta.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/silabs/wfx/sta.c b/drivers/net/wireless/silabs/wfx/sta.c index 496b93de3ee58..1b6c158457b42 100644 --- a/drivers/net/wireless/silabs/wfx/sta.c +++ b/drivers/net/wireless/silabs/wfx/sta.c @@ -96,8 +96,11 @@ void wfx_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, *total_flags &= FIF_BCN_PRBRESP_PROMISC | FIF_ALLMULTI | FIF_OTHER_BSS | FIF_PROBE_REQ | FIF_PSPOLL; + /* Filters are ignored during the scan. No frames are filtered. */ + if (mutex_is_locked(&wdev->scan_lock)) + return; + mutex_lock(&wdev->conf_mutex); - mutex_lock(&wdev->scan_lock); while ((wvif = wvif_iterate(wdev, wvif)) != NULL) { /* Note: FIF_BCN_PRBRESP_PROMISC covers probe response and * beacons from other BSS @@ -126,7 +129,6 @@ void wfx_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags, filter_prbreq = true; wfx_hif_set_rx_filter(wvif, filter_bssid, filter_prbreq); } - mutex_unlock(&wdev->scan_lock); mutex_unlock(&wdev->conf_mutex); }