asoc: compress: race condition handling in stream cmd put function

protect driver data using mutex lock available to protect against
race condtion due to multiple thread access.

Change-Id: I7dbff3448958b1700ecca2a090fcb915d5809f30
(cherry picked from commit a9530af1782911e76fa765fd9db7c1ad20710f1d)
This commit is contained in:
Shalini Manjunatha 2025-06-16 19:10:01 +05:30 • committed by Nageshwar Reddy Goli
commit ad1e75a8ed

View file

@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.​
*/
@ -4219,6 +4220,7 @@ static int msm_compr_adsp_stream_cmd_put(struct snd_kcontrol *kcontrol,
return -EINVAL;
}
mutex_lock(&pdata->lock);
cstream = pdata->cstream[fe_id];
if (cstream == NULL) {
pr_err("%s cstream is null\n", __func__);
@ -4231,7 +4233,6 @@ static int msm_compr_adsp_stream_cmd_put(struct snd_kcontrol *kcontrol,
return -EINVAL;
}
mutex_lock(&pdata->lock);
if (prtd->audio_client == NULL) {
pr_err("%s: audio_client is null\n", __func__);
ret = -EINVAL;