]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: ath12k: Fix locking in "QMI firmware ready" error paths
authorBart Van Assche <bvanassche@acm.org>
Thu, 6 Feb 2025 22:13:17 +0000 (14:13 -0800)
committerJeff Johnson <jeff.johnson@oss.qualcomm.com>
Tue, 11 Feb 2025 15:27:10 +0000 (07:27 -0800)
If ag->mutex has been locked, unlock it before returning. If it has not
been locked, do not unlock it before returning. These bugs have been
detected by the Clang thread-safety analyzer.

Cc: Karthikeyan Periyasamy <quic_periyasa@quicinc.com>
Cc: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
Fixes: ee146e11b4d9 ("wifi: ath12k: refactor core start based on hardware group")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Aditya Kumar Singh <aditya.kumar.singh@oss.qualcomm.com>
Link: https://patch.msgid.link/20250206221317.3845663-1-bvanassche@acm.org
Signed-off-by: Jeff Johnson <jeff.johnson@oss.qualcomm.com>
drivers/net/wireless/ath/ath12k/core.c

index 323bd5082a7ddedb3c1c7416dd5e87dfd8aa11a9..e820462f4f1dd5f0d0fb3091d4ade61f1fb39648 100644 (file)
@@ -1132,16 +1132,18 @@ err_core_stop:
                ath12k_core_stop(ab);
                mutex_unlock(&ab->core_lock);
        }
+       mutex_unlock(&ag->mutex);
        goto exit;
 
 err_dp_free:
        ath12k_dp_free(ab);
        mutex_unlock(&ab->core_lock);
+       mutex_unlock(&ag->mutex);
+
 err_firmware_stop:
        ath12k_qmi_firmware_stop(ab);
 
 exit:
-       mutex_unlock(&ag->mutex);
        return ret;
 }