mirror of
https://github.com/torvalds/linux.git
synced 2026-10-08 19:46:02 +02:00
drm/msm: Only fini scheduler after successful init
msm_ringbuffer_new() destroys a partially initialized ring through
msm_ringbuffer_destroy() when an allocation or scheduler setup step
fails.
If drm_sched_init() fails before it finishes initializing the scheduler,
the failure path still calls drm_sched_fini(). That teardown path assumes
the scheduler work items, lists, and workqueue state were initialized.
Track successful scheduler initialization and call drm_sched_fini() only
after drm_sched_init() returned 0.
This issue was found by a static analysis checker and confirmed by
manual source review.
Fixes: 1d8a5ca436 ("drm/msm: Conversion to drm scheduler")
Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com>
Patchwork: https://patchwork.freedesktop.org/patch/738905/
Message-ID: <20260709062309.4168362-1-ruoyuw560@gmail.com>
Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
This commit is contained in:
parent
40b793714a
commit
e2332abed2
|
|
@ -109,9 +109,9 @@ struct msm_ringbuffer *msm_ringbuffer_new(struct msm_gpu *gpu, int id,
|
|||
ring->memptrs_iova = memptrs_iova;
|
||||
|
||||
ret = drm_sched_init(&ring->sched, &args);
|
||||
if (ret) {
|
||||
if (ret)
|
||||
goto fail;
|
||||
}
|
||||
ring->sched_initialized = true;
|
||||
|
||||
INIT_LIST_HEAD(&ring->submits);
|
||||
spin_lock_init(&ring->submit_lock);
|
||||
|
|
@ -133,7 +133,8 @@ void msm_ringbuffer_destroy(struct msm_ringbuffer *ring)
|
|||
if (IS_ERR_OR_NULL(ring))
|
||||
return;
|
||||
|
||||
drm_sched_fini(&ring->sched);
|
||||
if (ring->sched_initialized)
|
||||
drm_sched_fini(&ring->sched);
|
||||
|
||||
msm_fence_context_free(ring->fctx);
|
||||
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ struct msm_ringbuffer {
|
|||
* The job scheduler for this ring.
|
||||
*/
|
||||
struct drm_gpu_scheduler sched;
|
||||
bool sched_initialized;
|
||||
|
||||
/*
|
||||
* List of in-flight submits on this ring. Protected by submit_lock.
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user