msm: vidc: Fix crash due to invalid instance access

Invalid instance access can happen in sys error handler
as instance can be deleted after core lock is released.

Add change to print all instance info within core lock
to avoid access to invalid instance.

Change-Id: Ib4090730d347b9865f211e9cf22d30951739f741
Signed-off-by: Surajit Podder <spodder@codeaurora.org>
This commit is contained in:
Surajit Podder 2017-02-02 14:29:55 +05:30 committed by Gerrit - the friendly Code Review server
parent 336e245503
commit e5fdaa6b3b

View file

@ -1693,19 +1693,11 @@ static void handle_sys_error(enum hal_command_response cmd, void *data)
dprintk(VIDC_ERR,
"SYS_ERROR can potentially crash the system\n");
/*
* For SYS_ERROR, there will not be any inst pointer.
* Just grab one of the inst from instances list and
* use it.
*/
mutex_lock(&core->lock);
inst = list_first_entry_or_null(&core->instances,
struct msm_vidc_inst, list);
list_for_each_entry(inst, &core->instances, list)
msm_comm_print_inst_info(inst);
mutex_unlock(&core->lock);
msm_comm_print_debug_info(inst);
BUG_ON(core->resources.debug_timeout);
}