Commit d25e3a61 authored by Philipp Stanner's avatar Philipp Stanner
Browse files

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: stable@vger.kernel.org # v5.13+
Fixes: ac4eb83a ("drm/sched: select new rq even if there is only one v3")
Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@igalia.com>
Signed-off-by: default avatarPhilipp Stanner <phasta@kernel.org>
Link: https://patch.msgid.link/20251022063402.87318-2-phasta@kernel.org
parent 14e02ed3
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -552,10 +552,11 @@ void drm_sched_entity_select_rq(struct drm_sched_entity *entity)
		drm_sched_rq_remove_entity(entity->rq, entity);
		entity->rq = rq;
	}
	spin_unlock(&entity->lock);

	if (entity->num_sched_list == 1)
		entity->sched_list = NULL;

	spin_unlock(&entity->lock);
}

/**