diff options
author | Junwei Zhang <Jerry.Zhang@amd.com> | 2018-07-16 05:53:43 +0300 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2018-07-17 00:11:48 +0300 |
commit | a6da48caf92b4b6119cae146259528bec0e48545 (patch) | |
tree | d3f0039bf76703f6228925ddc6db4bc1fc29eafd /drivers/gpu/drm/scheduler | |
parent | 964d0fbf6301d3dc8dfad19ffab5a06d002d27f1 (diff) | |
download | linux-a6da48caf92b4b6119cae146259528bec0e48545.tar.xz |
drm/scheduler: add NULL pointer check for run queue (v2)
To check rq pointer before adding entity into it.
That avoids NULL pointer access in some case.
v2: move the check to caller
Suggested-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/scheduler')
-rw-r--r-- | drivers/gpu/drm/scheduler/gpu_scheduler.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/gpu/drm/scheduler/gpu_scheduler.c b/drivers/gpu/drm/scheduler/gpu_scheduler.c index 16bf446aa6b3..dac71e3b4514 100644 --- a/drivers/gpu/drm/scheduler/gpu_scheduler.c +++ b/drivers/gpu/drm/scheduler/gpu_scheduler.c @@ -547,6 +547,11 @@ void drm_sched_entity_push_job(struct drm_sched_job *sched_job, if (first) { /* Add the entity to the run queue */ spin_lock(&entity->rq_lock); + if (!entity->rq) { + DRM_ERROR("Trying to push to a killed entity\n"); + spin_unlock(&entity->rq_lock); + return; + } drm_sched_rq_add_entity(entity->rq, entity); spin_unlock(&entity->rq_lock); drm_sched_wakeup(sched); |