dsp: audio_ion: add lock for msm_audio_ion_crash_handler

msm_audio_fd_data can be freed in msm_audio_delete_fd_entry and
msm_audio_ion_crash_handler.Add lock for msm_audio_ion_crash_handler
to avoid race condition during removal of msm_audio_fd_data and dereference.

Change-Id: I49dc0a1aca45ffad76b39e06fe075185d4281d00
Signed-off-by: Meng Wang <mengw@codeaurora.org>
This commit is contained in:
Meng Wang
2021-05-18 15:02:00 +08:00
parent f1b8ccfee3
commit f16860d03a

View File

@@ -572,6 +572,7 @@ void msm_audio_ion_crash_handler(void)
struct msm_audio_ion_private *ion_data = NULL;
pr_debug("Inside %s\n", __func__);
mutex_lock(&(msm_audio_ion_fd_list.list_mutex));
list_for_each_entry(msm_audio_fd_data,
&msm_audio_ion_fd_list.fd_list, list) {
handle = msm_audio_fd_data->handle;
@@ -585,6 +586,7 @@ void msm_audio_ion_crash_handler(void)
list_del(&(msm_audio_fd_data->list));
kfree(msm_audio_fd_data);
}
mutex_unlock(&(msm_audio_ion_fd_list.list_mutex));
}
EXPORT_SYMBOL(msm_audio_ion_crash_handler);