Re: [PATCH 5.10 040/491] wifi: cw1200: Fix locking in error paths

Ben Hutchings
2026-04-14T20:48:57Z

[-- Attachment #1: Type: text/plain, Size: 2072 bytes --]

On Mon, 2026-04-13 at 17:54 +0200, Greg Kroah-Hartman wrote:
> 5.10-stable review patch. If anyone has any objections, please let me know.
>
> ------------------
>
> From: Bart Van Assche <bvanassche@acm.org>
>
> [ Upstream commit d98c24617a831e92e7224a07dcaed2dd0b02af96 ]
>
> cw1200_wow_suspend() must only return with priv->conf_mutex locked if it
> returns zero. This mutex must be unlocked if an error is returned. Add
> mutex_unlock() calls to the error paths from which that call is missing.

These error paths already call cw1200_wow_resume() which unlocks
conf_mutex. So this is introducing and not fixing a locking bug.
Please drop this from all stable queues and revert it upstream.

> This has been detected by the Clang thread-safety analyzer.

A bug report against that analyser may also be in order!

Ben.

>
> Fixes: a910e4a94f69 ("cw1200: add driver for the ST-E CW1100 & CW1200 WLAN chipsets")
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> Link: https://patch.msgid.link/20260223220102.2158611-25-bart.vanassche@linux.dev
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
> drivers/net/wireless/st/cw1200/pm.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/wireless/st/cw1200/pm.c b/drivers/net/wireless/st/cw1200/pm.c
> index a20ab577a3644..212b6f2af8de4 100644
> --- a/drivers/net/wireless/st/cw1200/pm.c
> +++ b/drivers/net/wireless/st/cw1200/pm.c
> @@ -264,12 +264,14 @@ int cw1200_wow_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)
> wiphy_err(priv->hw->wiphy,
> "PM request failed: %d. WoW is disabled.\n", ret);
> cw1200_wow_resume(hw);
> + mutex_unlock(&priv->conf_mutex);
> return -EBUSY;
> }
>
> /* Force resume if event is coming from the device. */
> if (atomic_read(&priv->bh_rx)) {
> cw1200_wow_resume(hw);
> + mutex_unlock(&priv->conf_mutex);
> return -EAGAIN;
> }
>

--
Ben Hutchings
73.46% of all statistics are made up.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]