[PATCH] drm/scheduler: add NULL pointer check for run queue
Christian König
ckoenig.leichtzumerken at gmail.com
Mon Jul 16 08:31:26 UTC 2018
Am 16.07.2018 um 04:59 schrieb Junwei Zhang:
> To check rq pointer before adding entity into it.
> That avoids NULL pointer access in some case.
>
> Suggested-by: Christian König <christian.koenig at amd.com>
> Signed-off-by: Junwei Zhang <Jerry.Zhang at amd.com>
> ---
> drivers/gpu/drm/scheduler/gpu_scheduler.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/gpu/drm/scheduler/gpu_scheduler.c b/drivers/gpu/drm/scheduler/gpu_scheduler.c
> index 16bf446..5e5268d 100644
> --- a/drivers/gpu/drm/scheduler/gpu_scheduler.c
> +++ b/drivers/gpu/drm/scheduler/gpu_scheduler.c
> @@ -91,6 +91,10 @@ static void drm_sched_rq_add_entity(struct drm_sched_rq *rq,
> {
> if (!list_empty(&entity->list))
> return;
> + if (!rq) {
> + DRM_ERROR("rq is NULL!\n");
> + return;
> + }
Better put that into drm_sched_entity_push_job(), e.g. something like:
/* first job wakes up scheduler */
if (first) {
/* Add the entity to the run queue */
spin_lock(&entity->rq_lock);
if (!entity->rq) {
DRM_ERROR("Trying to push to killed entity!\n");
....
Regards,
Christian.
> spin_lock(&rq->lock);
> list_add_tail(&entity->list, &rq->entities);
> spin_unlock(&rq->lock);
More information about the amd-gfx
mailing list