[PATCH] wifi: ath12k: Fix locking in error paths

Aditya Kumar Singh aditya.kumar.singh at oss.qualcomm.com
Sun Feb 9 19:33:34 PST 2025


On 2/7/25 20:40, Jeff Johnson wrote:
> On 2/6/2025 2:13 PM, Bart Van Assche wrote:
>> 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 at quicinc.com>
>> Cc: Jeff Johnson <jeff.johnson at oss.qualcomm.com>
>> Fixes: ee146e11b4d9 ("wifi: ath12k: refactor core start based on hardware group")
>> Signed-off-by: Bart Van Assche <bvanassche at acm.org>
>> ---
>>   drivers/net/wireless/ath/ath12k/core.c | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c
>> index 0606116d6b9c..212cd935e60a 100644
>> --- a/drivers/net/wireless/ath/ath12k/core.c
>> +++ b/drivers/net/wireless/ath/ath12k/core.c
>> @@ -1122,16 +1122,18 @@ int ath12k_core_qmi_firmware_ready(struct ath12k_base *ab)
>>   		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;
>>   }
>>   
> 
> I made the subject a bit more descriptive in the pending branch:
> https://git.kernel.org/pub/scm/linux/kernel/git/ath/ath.git/commit/?h=pending&id=09a2421b6e5f617cfbeab906fa8037dda4aa95b8

Better now, thanks.


-- 
Aditya



More information about the ath12k mailing list