* Re: [PATCH] drm/panfrost: fix stuck reset.pending on JOB_BUS_FAULT
[not found] <a3b7a3f3-4da6-4a41-b842-cf9778dd7ba1@performanc.org>
@ 2026-11-19 19:28 ` sashiko-bot
0 siblings, 0 replies; only message in thread
From: sashiko-bot @ 2026-11-19 19:28 UTC (permalink / raw)
To: ThePedroo, dri-devel
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] drm/panfrost: use-after-free in panfrost_jm_fini() [1]
--
commit 425df48a8a39ab3673476c8b751250446dcc35c8
Author: Pedro Olímpio <pedro@performanc.org>
drm/panfrost: fix stuck reset.pending on JOB_BUS_FAULT
This commit replaces the drm_sched_fault() call in panfrost_job_handle_err()
with panfrost_device_schedule_reset() so that a GPU reset runs even after
job->done_fence has been signaled.
> diff --git a/drivers/gpu/drm/panfrost/panfrost_job.c b/drivers/gpu/drm/panfrost/panfrost_job.c
> index 3a46dd61cf87f..3c3107d706795 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_job.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_job.c
> @@ -499,10 +499,8 @@ static void panfrost_job_handle_err(struct panfrost_device *pfdev,
>
> pm_runtime_put_autosuspend(pfdev->base.dev);
>
> - if (panfrost_exception_needs_reset(pfdev, js_status)) {
> - atomic_set(&pfdev->reset.pending, 1);
> - drm_sched_fault(&pfdev->js->queue[js].sched);
> - }
> + if (panfrost_exception_needs_reset(pfdev, js_status))
> + panfrost_device_schedule_reset(pfdev);
> }
>
> static void panfrost_jm_handle_done(struct panfrost_device *pfdev,
[Severity: Critical]
This problem wasn't introduced by this patch, but can a pending
pfdev->reset.work item race with panfrost_jm_fini() [1] and access
js->queue[j].sched after drm_sched_fini()?
drivers/gpu/drm/panfrost/panfrost_job.c:panfrost_jm_fini() {
...
for (j = 0; j < NUM_JOB_SLOTS; j++) {
drm_sched_fini(&js->queue[j].sched);
}
disable_work_sync(&pfdev->reset.work);
...
}
CPU0 CPU1 (pfdev->reset.wq)
panfrost_jm_fini()
drm_sched_fini(&js->queue[j].sched)
panfrost_reset()
drm_sched_stop() <-- use-after-free
disable_work_sync(&pfdev->reset.work)
If a reset queued via panfrost_device_schedule_reset() runs during driver
teardown before disable_work_sync() cancels it, panfrost_reset() calls
drm_sched_stop() on the already finalized scheduler.
[1] https://sashiko.dev/#/bug/linux-3c56dd27-0f33-4f82-a144-72279b21c756
--
Sashiko AI review · https://sashiko.dev/#/patchset/a3b7a3f3-4da6-4a41-b842-cf9778dd7ba1@performanc.org?part=1
^ permalink raw reply [flat|nested] only message in thread