Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2268074iof; Wed, 8 Jun 2022 00:57:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6C46I/ny8OiEwo3Lk1wOB5kqy+GtO91O1YFvkGNiXiF5W0k6pI9xAh5Qj6Gje4p9tvYbk X-Received: by 2002:a17:902:c2d8:b0:15e:fa17:56cc with SMTP id c24-20020a170902c2d800b0015efa1756ccmr33198324pla.40.1654675074034; Wed, 08 Jun 2022 00:57:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654675074; cv=none; d=google.com; s=arc-20160816; b=yR01VCMZ0WTUHjMhxXlwYqk85DzSKhscrUUoxxNDs00pxvw67ClnNenu1Dp8scx1Yg xwpwUZqBHdyVb+PHZKBwLrobQbi7RBdchsXb+mc0lLd3HNo272mkutmvYhSefUuICAGX x14x2UlVaODKJmutEvjjfRG6d2PEmsyEk7ARdmPvBVKxNrZe2mpAqh/0Z/dJJgVoxTYG pZBMgDl7sj+GpWtBo7CYFnN80yNyE6FmtaEe0Mxqy3q3QbbBzOb94kOYdCjppJyNPxgo qDFw+qLcpM+LrXl27+wf4X9iaNTiZA9oqy9Kr0rHTnpGuU2aMm4k9MMzkRCKkPeyBlmP LRkw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Z9Hoe6nbz4Jd4f8jZTEAZYxSKMfZAhm6W4FIx4fik40=; b=LvgV3SqPfo6PEJd0hC/VS9ZDo1Fpkt4cOwV90Vbi8q2pzSEXvqnQxmHGaLGIQx1yBT xur0tCXTfu3G+PgWW2XbDrvzCNyDAjfh9gWUrxfzTUHr9o7w5m4eKp5KYs7app+IeLZ+ NYfBMW0T5/6cPM1AgWh9WsiIwGOC5zi7ZU/ow0upV+zRUZyN831YmPpsWRJIyyNWNWLT WeC92/c6Ff6ETFxdOOtHzjJGBeZkqX8ydEwMvRepPbhINXnZbn2l6tvwk3pl2oV4xFqF TqrUcfZKA0L2lrgNBC/GwDekNc2zIXHd5xEYJMvF0N5DLwWJnxWLFbsCu68VB7gJYFpN TXsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=srM6ZS3j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s185-20020a632cc2000000b003fe22d73829si3006351pgs.186.2022.06.08.00.57.42; Wed, 08 Jun 2022 00:57:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=srM6ZS3j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377539AbiFGWEJ (ORCPT + 99 others); Tue, 7 Jun 2022 18:04:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378622AbiFGVEM (ORCPT ); Tue, 7 Jun 2022 17:04:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 474FB18C05D; Tue, 7 Jun 2022 11:48:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 755746168E; Tue, 7 Jun 2022 18:48:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DF2EC385A5; Tue, 7 Jun 2022 18:48:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654627729; bh=zLKqJ7YRx9+AQT3UXBkTEmxLVA2wtgkhaELDhD9VzXs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=srM6ZS3jlJ0Dwzh9hWoMGJb/d6JQlGSvNLcXyE2m19JV7Cb5BsiAMzVmvVt/x4Kw+ gnUlaCuu3XY7IGe48caK4QIt32XzhRzkTcfzE2iqJ98H9EHhHi6n49VY21tgLeVN6A CmR2v1Q2WLNrA5oUo0rCz4Ujhry65kB2HcxC9eRo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Norris , Niels Dossche , Kalle Valo , Sasha Levin Subject: [PATCH 5.18 065/879] mwifiex: add mutex lock for call in mwifiex_dfs_chan_sw_work_queue Date: Tue, 7 Jun 2022 18:53:03 +0200 Message-Id: <20220607165004.579924791@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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-kernel@vger.kernel.org From: Niels Dossche [ Upstream commit 3e12968f6d12a34b540c39cbd696a760cc4616f0 ] 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 Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220321225515.32113-1-dossche.niels@gmail.com Signed-off-by: Sasha Levin --- 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