From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Niels Dossche <dossche.niels@gmail.com>,
Brian Norris <briannorris@chromium.org>,
Kalle Valo <kvalo@kernel.org>, Sasha Levin <sashal@kernel.org>,
amitkarwar@gmail.com, ganapathi017@gmail.com,
sharvari.harisangam@nxp.com, huxinming820@gmail.com,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, linux-wireless@vger.kernel.org,
netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 4.9 02/24] mwifiex: add mutex lock for call in mwifiex_dfs_chan_sw_work_queue
Date: Mon, 30 May 2022 09:51:49 -0400 [thread overview]
Message-ID: <20220530135211.1937674-2-sashal@kernel.org> (raw)
In-Reply-To: <20220530135211.1937674-1-sashal@kernel.org>
From: Niels Dossche <dossche.niels@gmail.com>
[ 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 <briannorris@chromium.org>
Signed-off-by: Niels Dossche <dossche.niels@gmail.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/20220321225515.32113-1-dossche.niels@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
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 43dccd5b0291..3024a83c0f33 100644
--- a/drivers/net/wireless/marvell/mwifiex/11h.c
+++ b/drivers/net/wireless/marvell/mwifiex/11h.c
@@ -308,5 +308,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
next parent reply other threads:[~2022-05-30 14:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220530135211.1937674-1-sashal@kernel.org>
2022-05-30 13:51 ` Sasha Levin [this message]
2022-05-30 13:51 ` [PATCH AUTOSEL 4.9 03/24] b43legacy: Fix assigning negative value to unsigned variable Sasha Levin
2022-05-30 13:51 ` [PATCH AUTOSEL 4.9 04/24] b43: " Sasha Levin
2022-05-30 13:51 ` [PATCH AUTOSEL 4.9 05/24] ipw2x00: Fix potential NULL dereference in libipw_xmit() Sasha Levin
2022-05-30 13:51 ` [PATCH AUTOSEL 4.9 09/24] ath9k: fix QCA9561 PA bias level Sasha Levin
2022-05-30 13:52 ` [PATCH AUTOSEL 4.9 13/24] ipv6: Don't send rs packets to the interface of ARPHRD_TUNNEL Sasha Levin
2022-05-30 13:52 ` [PATCH AUTOSEL 4.9 15/24] net: remove two BUG() from skb_checksum_help() Sasha Levin
2022-05-30 13:52 ` [PATCH AUTOSEL 4.9 23/24] rxrpc: Return an error to sendmsg if call failed Sasha Levin
2022-05-30 13:52 ` [PATCH AUTOSEL 4.9 24/24] eth: tg3: silence the GCC 12 array-bounds warning Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220530135211.1937674-2-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=amitkarwar@gmail.com \
--cc=briannorris@chromium.org \
--cc=davem@davemloft.net \
--cc=dossche.niels@gmail.com \
--cc=edumazet@google.com \
--cc=ganapathi017@gmail.com \
--cc=huxinming820@gmail.com \
--cc=kuba@kernel.org \
--cc=kvalo@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sharvari.harisangam@nxp.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).