From a2e0e293dfe1662199a08974cfbd971aed91b9cb Mon Sep 17 00:00:00 2001 From: "Wan, Xinxin" Date: Mon, 24 Apr 2023 15:42:18 +0800 Subject: [PATCH] ASoC: Intel: avs: Check ida before free module Checking if the module ida is empty before releasing the module is needed. A direct free ida may cause a kernel null pointer exception when the DSP rebooting failed. Signed-off-by: Wan, Xinxin --- sound/soc/intel/avs/utils.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/soc/intel/avs/utils.c b/sound/soc/intel/avs/utils.c index 82416b86662d..14a98651bee8 100644 --- a/sound/soc/intel/avs/utils.c +++ b/sound/soc/intel/avs/utils.c @@ -222,7 +222,8 @@ void avs_module_id_free(struct avs_dev *adev, u16 module_id, u8 instance_id) goto exit; } - ida_free(adev->mod_idas[idx], instance_id); + if (!ida_is_empty(adev->mod_idas[idx])) + ida_free(adev->mod_idas[idx], instance_id); exit: mutex_unlock(&adev->modres_mutex); }