Skip to content

Commit d25e3a6

Browse files
author
Philipp Stanner
committed
drm/sched: Fix race in drm_sched_entity_select_rq()
In a past bug fix it was forgotten that entity access must be protected by the entity lock. That's a data race and potentially UB. Move the spin_unlock() to the appropriate position. Cc: [email protected] # v5.13+ Fixes: ac4eb83 ("drm/sched: select new rq even if there is only one v3") Reviewed-by: Tvrtko Ursulin <[email protected]> Signed-off-by: Philipp Stanner <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 14e02ed commit d25e3a6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/gpu/drm/scheduler/sched_entity.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,10 +552,11 @@ void drm_sched_entity_select_rq(struct drm_sched_entity *entity)
552552
drm_sched_rq_remove_entity(entity->rq, entity);
553553
entity->rq = rq;
554554
}
555-
spin_unlock(&entity->lock);
556555

557556
if (entity->num_sched_list == 1)
558557
entity->sched_list = NULL;
558+
559+
spin_unlock(&entity->lock);
559560
}
560561

561562
/**

0 commit comments

Comments
 (0)