From: Andrey Grodzovsky <andrey.grodzovsky@xxxxxxx> commit e582951baabba3e278c97169d0acc1e09b24a72e upstream. To avoid any possible use after free. Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@xxxxxxx> Reviewed-by: Christian König <christian.koenig@xxxxxxx> Link: https://patchwork.freedesktop.org/patch/414814/ CC: stable@xxxxxxxxxxxxxxx Signed-off-by: Christian König <christian.koenig@xxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/gpu/drm/scheduler/sched_main.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/gpu/drm/scheduler/sched_main.c +++ b/drivers/gpu/drm/scheduler/sched_main.c @@ -851,6 +851,9 @@ void drm_sched_fini(struct drm_gpu_sched if (sched->thread) kthread_stop(sched->thread); + /* Confirm no work left behind accessing device structures */ + cancel_delayed_work_sync(&sched->work_tdr); + sched->ready = false; } EXPORT_SYMBOL(drm_sched_fini);