dsp: audio_ion: Add checks before memmory access
-Add check for memory access in msm_audio_ion_crash_handler Change-Id: Idd7a51578260b2779c72040d99483de453c4330e
This commit is contained in:

committed by
Gerrit - the friendly Code Review server

parent
dbc8b3c1e1
commit
a241af4cf8
@@ -1,7 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2013-2021, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/init.h>
|
||||
@@ -610,23 +610,33 @@ void msm_audio_ion_crash_handler(void)
|
||||
struct msm_audio_ion_private *ion_data = NULL;
|
||||
|
||||
pr_debug("Inside %s\n", __func__);
|
||||
if(!msm_audio_ion_fd_list_init) {
|
||||
pr_err("%s: list not initialized yet, hence returning .... ", __func__);
|
||||
return;
|
||||
}
|
||||
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;
|
||||
ion_data = dev_get_drvdata(msm_audio_fd_data->dev);
|
||||
/* clean if CMA was used*/
|
||||
if (msm_audio_fd_data->hyp_assign) {
|
||||
msm_audio_hyp_unassign(msm_audio_fd_data);
|
||||
if(msm_audio_fd_data) {
|
||||
handle = msm_audio_fd_data->handle;
|
||||
ion_data = dev_get_drvdata(msm_audio_fd_data->dev);
|
||||
/* clean if CMA was used*/
|
||||
if (msm_audio_fd_data->hyp_assign)
|
||||
msm_audio_hyp_unassign(msm_audio_fd_data);
|
||||
if(handle)
|
||||
msm_audio_ion_free(handle, ion_data);
|
||||
}
|
||||
msm_audio_ion_free(handle, ion_data);
|
||||
}
|
||||
list_for_each_safe(ptr, next,
|
||||
&msm_audio_ion_fd_list.fd_list) {
|
||||
msm_audio_fd_data = list_entry(ptr, struct msm_audio_fd_data,
|
||||
list);
|
||||
list_del(&(msm_audio_fd_data->list));
|
||||
kfree(msm_audio_fd_data);
|
||||
if(ptr) {
|
||||
msm_audio_fd_data = list_entry(ptr, struct msm_audio_fd_data,
|
||||
list);
|
||||
if(msm_audio_fd_data) {
|
||||
list_del(&(msm_audio_fd_data->list));
|
||||
kfree(msm_audio_fd_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
mutex_unlock(&(msm_audio_ion_fd_list.list_mutex));
|
||||
}
|
||||
|
Reference in New Issue
Block a user