mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-09 02:45:20 +02:00
drm/amdkfd: Check debug trap enable before write dbg_ev_file
[ Upstream commit 547033b593
]
In interrupt context, write dbg_ev_file will be run by work queue. It
will cause write dbg_ev_file execution after debug_trap_disable, which
will cause NULL pointer access.
v2: cancel work "debug_event_workarea" before set dbg_ev_file as NULL.
Signed-off-by: Lin.Cao <lincao12@amd.com>
Reviewed-by: Jonathan Kim <jonathan.kim@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
a60d1f7ff6
commit
e6ea3b8fe3
|
@ -103,6 +103,7 @@ void debug_event_write_work_handler(struct work_struct *work)
|
|||
struct kfd_process,
|
||||
debug_event_workarea);
|
||||
|
||||
if (process->debug_trap_enabled && process->dbg_ev_file)
|
||||
kernel_write(process->dbg_ev_file, &write_data, 1, &pos);
|
||||
}
|
||||
|
||||
|
@ -645,6 +646,7 @@ int kfd_dbg_trap_disable(struct kfd_process *target)
|
|||
else if (target->runtime_info.runtime_state != DEBUG_RUNTIME_STATE_DISABLED)
|
||||
target->runtime_info.runtime_state = DEBUG_RUNTIME_STATE_ENABLED;
|
||||
|
||||
cancel_work_sync(&target->debug_event_workarea);
|
||||
fput(target->dbg_ev_file);
|
||||
target->dbg_ev_file = NULL;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user