Skip to content

Commit 6be3d7f

Browse files
Philipp Stannergregkh
authored andcommitted
drm/sched: Fix race in drm_sched_entity_select_rq()
[ Upstream commit d25e3a6 ] 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: stable@vger.kernel.org # v5.13+ Fixes: ac4eb83 ("drm/sched: select new rq even if there is only one v3") Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com> Signed-off-by: Philipp Stanner <phasta@kernel.org> Link: https://patch.msgid.link/20251022063402.87318-2-phasta@kernel.org Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent f78da4c commit 6be3d7f

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
@@ -558,10 +558,11 @@ void drm_sched_entity_select_rq(struct drm_sched_entity *entity)
558558
drm_sched_rq_remove_entity(entity->rq, entity);
559559
entity->rq = rq;
560560
}
561-
spin_unlock(&entity->lock);
562561

563562
if (entity->num_sched_list == 1)
564563
entity->sched_list = NULL;
564+
565+
spin_unlock(&entity->lock);
565566
}
566567

567568
/**

0 commit comments

Comments
 (0)