]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: wlcore: Fix a locking bug
authorBart Van Assche <bvanassche@acm.org>
Mon, 23 Feb 2026 22:00:25 +0000 (14:00 -0800)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 3 Mar 2026 11:02:05 +0000 (12:02 +0100)
Make sure that wl->mutex is locked before it is unlocked. This has been
detected by the Clang thread-safety analyzer.

Fixes: 45aa7f071b06 ("wlcore: Use generic runtime pm calls for wowlan elp configuration")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://patch.msgid.link/20260223220102.2158611-26-bart.vanassche@linux.dev
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/ti/wlcore/main.c

index 17dd417756f29cc08363f129b321384f3f5ca988..1c340a4a09308fbf987f0745610fa538a3b80e2b 100644 (file)
@@ -1875,6 +1875,8 @@ static int __maybe_unused wl1271_op_resume(struct ieee80211_hw *hw)
                     wl->wow_enabled);
        WARN_ON(!wl->wow_enabled);
 
+       mutex_lock(&wl->mutex);
+
        ret = pm_runtime_force_resume(wl->dev);
        if (ret < 0) {
                wl1271_error("ELP wakeup failure!");
@@ -1891,8 +1893,6 @@ static int __maybe_unused wl1271_op_resume(struct ieee80211_hw *hw)
                run_irq_work = true;
        spin_unlock_irqrestore(&wl->wl_lock, flags);
 
-       mutex_lock(&wl->mutex);
-
        /* test the recovery flag before calling any SDIO functions */
        pending_recovery = test_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS,
                                    &wl->flags);