From: Amadeusz Sławiński Date: Fri, 19 May 2023 20:17:06 +0000 (+0200) Subject: ASoC: Intel: avs: Access path components under lock X-Git-Tag: baikal/aarch64/sdk6.2~23 X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=c95bab4912cb369f1d9f3a15a4243a9da976e4fa;p=kernel.git ASoC: Intel: avs: Access path components under lock commit d849996f7458042af803b7d15a181922834c5249 upstream. Path and its components should be accessed under lock to prevent problems with one thread modifying them while other tries to read. Fixes: 6af0b3fd1368 ("ASoC: Intel: avs: APL-based platforms support") Reviewed-by: Cezary Rojewski Signed-off-by: Amadeusz Sławiński Link: https://lore.kernel.org/r/20230519201711.4073845-3-amadeuszx.slawinski@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman --- diff --git a/sound/soc/intel/avs/apl.c b/sound/soc/intel/avs/apl.c index b8e2b23c9f642..f366478a875de 100644 --- a/sound/soc/intel/avs/apl.c +++ b/sound/soc/intel/avs/apl.c @@ -173,6 +173,7 @@ static bool apl_lp_streaming(struct avs_dev *adev) { struct avs_path *path; + spin_lock(&adev->path_list_lock); /* Any gateway without buffer allocated in LP area disqualifies D0IX. */ list_for_each_entry(path, &adev->path_list, node) { struct avs_path_pipeline *ppl; @@ -192,11 +193,14 @@ static bool apl_lp_streaming(struct avs_dev *adev) if (cfg->copier.dma_type == INVALID_OBJECT_ID) continue; - if (!mod->gtw_attrs.lp_buffer_alloc) + if (!mod->gtw_attrs.lp_buffer_alloc) { + spin_unlock(&adev->path_list_lock); return false; + } } } } + spin_unlock(&adev->path_list_lock); return true; }