Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2317188pxp; Mon, 21 Mar 2022 16:46:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyB7QNGLndCxGw7M9+OnCKD3J3a9Ostf1d2yKJNdgL16lKVc2FKUv6m1gSH2JJEUCXthvJm X-Received: by 2002:a17:90b:314d:b0:1bf:1dc5:8e8d with SMTP id ip13-20020a17090b314d00b001bf1dc58e8dmr1700335pjb.204.1647906385491; Mon, 21 Mar 2022 16:46:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647906385; cv=none; d=google.com; s=arc-20160816; b=H2Hgo48Vms6sHM5QrCDDhDECSeRIAI16d86zCs1cZD0cBd6qcT05w2hcEalPf2BNtw AMP55nPTXBv2N9KpAY7bHFDg+Q0V0gaQGGRgc5knda3fy7BrCQ9DHlunLyR0Ds5i8ktx sfgX4yDkkZudtMSmf3gCaEbLQ5pUlFGUFUDAG1nW5/HHl603ME2/gszRG7Hp0TnTmwtB o+ZEPMulPEsB1JXbTYWYRTwpgv+6qSuhfR+Qcvikl9SPVrT+JLn5xhV+VNlzvbC2ONWH Jzetk0cFxUcnEcGKNn540lKTOdbDzZ8Ulq2kDoIEIan/N74b3TQ2taStzorv6bOJrnoY nalg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=mTDlP+uXn5kbgAw1udfHWGoa/+ze9Zqyhy1PS/mbCas=; b=Ufx9H7GDDEkszvrXh4xMg6ZlgTD8RVCH809Hooavd8nocPJ2vY7Y3Zpx2mXZEn87mi T02D3qP5npsG6Lu/kex9fzsgDVjw5cmpSYG71xJKS96HoMSk8Lw1Bd4R98jdMpAWCv1x 15XQhTRM0t2HSEIHSv7sFi0724aYLD/ZkzgMyCgauWpcr+ovgz6gL/SB80nQhez0Qkfo coxtRv2bwa1Rg+uf1MoqX8MvU2ghd4TeP8EnZcgd73KLFsrltzEA5oi2q8ejgF9tXWBs XR+YYc46U5nQIJnK/Qwhge3KdoGYSMcc53smQ3McoKiH/VzjmelNbbzc4f8yoDar/Ra8 SWeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=aqEMYq2U; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id j21-20020a632315000000b00382b764886bsi1207111pgj.121.2022.03.21.16.46.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 16:46:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=aqEMYq2U; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7DB8D357B7F; Mon, 21 Mar 2022 16:08:57 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231802AbiCUXKL (ORCPT + 70 others); Mon, 21 Mar 2022 19:10:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233639AbiCUXIv (ORCPT ); Mon, 21 Mar 2022 19:08:51 -0400 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F07156413 for ; Mon, 21 Mar 2022 15:57:10 -0700 (PDT) Received: by mail-ej1-x632.google.com with SMTP id bg10so32789493ejb.4 for ; Mon, 21 Mar 2022 15:57:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=mTDlP+uXn5kbgAw1udfHWGoa/+ze9Zqyhy1PS/mbCas=; b=aqEMYq2Uh+dZtSswuQ1d/cNppXoA7f2SZjrw52Lk6BwVSAZpdojLtqRF7lSKo7htZh 6mhhr3ZpVIqaVt3dGPPXdwNphDNbc8NAQ+WxjkUFlMhqKy/DA2XeAzk29aEKxwI34Xqv 5YTBNRi8XqgKloH6ObtWDnRv/SVW/tt12QIAOIMKi1IAMRx210EwgDe7pDLI1ZeSCFhV DrPz6G90KIqeQBw8jEk1xhDpQiNcOrjfAgegyMZeV7zidux+ZHthpy9A6TZEMhGT3NcM 1h3GOy9dqv479ezZzMRMU84kIrjFi9ugE6qe4E6yj6UuxrxLcaTzlVPejtT1uHNzdSc9 Tzqw== 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:mime-version :content-transfer-encoding; bh=mTDlP+uXn5kbgAw1udfHWGoa/+ze9Zqyhy1PS/mbCas=; b=mDCFvC8csnvHqW8Oc4fGkpg5txi3S5ZBWVzN4uJ8dr3IvzOLR++X1j7Ko/hA0jPaLg A15Wf5EAhp/ggYVGomLLCGu68qfFMgU1iI3JYKHJxNMg0AvoKOEskH96hLT0vTPTKP6f GaCF/FTvjZVLoYAS7WBCDTYlT5dx/q9WPSyU+LcQuNAFTZ7PncLEeuO955QxtVS6dJKF uiIvhmth4lUfpPq5tWC4QS1X41s869aFwAPAY2g6sySVVBj0RK5DJqOG1WP0L8oSoBP5 nBBMa1VXCp/Isc/BgBwcXfRGG1l8mMG7HIXWMG7DFLltQOz5eVMN++bomMJQqCr+3tec Mbfg== X-Gm-Message-State: AOAM533njp1ZX/XxHNeRbarZgysz9x3VWFmFRwRnECN2vzkurjeIg5/H jREux1ECGUnSSOSxcq5AUjwG6LBD0tBMKw== X-Received: by 2002:a17:907:7242:b0:6da:b561:d523 with SMTP id ds2-20020a170907724200b006dab561d523mr22536109ejc.118.1647903339018; Mon, 21 Mar 2022 15:55:39 -0700 (PDT) Received: from nlaptop.localdomain (ptr-dtfv0poj8u7zblqwbt6.18120a2.ip6.access.telenet.be. [2a02:1811:cc83:eef0:f2b6:6987:9238:41ca]) by smtp.gmail.com with ESMTPSA id i10-20020aa7dd0a000000b00419286d4824sm3320099edv.40.2022.03.21.15.55.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 15:55:38 -0700 (PDT) From: Niels Dossche To: linux-wireless@vger.kernel.org Cc: Amitkumar Karwar , Ganapathi Bhat , Sharvari Harisangam , Xinming Hu , Kalle Valo , Brian Norris , Niels Dossche Subject: [PATCH v2] mwifiex: add mutex lock for call in mwifiex_dfs_chan_sw_work_queue Date: Mon, 21 Mar 2022 23:55:16 +0100 Message-Id: <20220321225515.32113-1-dossche.niels@gmail.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org cfg80211_ch_switch_notify uses ASSERT_WDEV_LOCK to assert that net_device->ieee80211_ptr->mtx (which is the same as priv->wdev.mtx) is held during the function's execution. mwifiex_dfs_chan_sw_work_queue is one of its callers, which does not hold that lock, therefore violating the assertion. Add a lock around the call. Disclaimer: I am currently working on a static analyser to detect missing locks. This was a reported case. I manually verified the report by looking at the code, so that I do not send wrong information or patches. After concluding that this seems to be a true positive, I created this patch. However, as I do not in fact have this particular hardware, I was unable to test it. Reviewed-by: Brian Norris Signed-off-by: Niels Dossche --- drivers/net/wireless/marvell/mwifiex/11h.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/wireless/marvell/mwifiex/11h.c b/drivers/net/wireless/marvell/mwifiex/11h.c index d2ee6469e67b..3fa25cd64cda 100644 --- a/drivers/net/wireless/marvell/mwifiex/11h.c +++ b/drivers/net/wireless/marvell/mwifiex/11h.c @@ -303,5 +303,7 @@ void mwifiex_dfs_chan_sw_work_queue(struct work_struct *work) mwifiex_dbg(priv->adapter, MSG, "indicating channel switch completion to kernel\n"); + mutex_lock(&priv->wdev.mtx); cfg80211_ch_switch_notify(priv->netdev, &priv->dfs_chandef); + mutex_unlock(&priv->wdev.mtx); } -- 2.35.1