All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/scheduler: add NULL pointer check for run queue
@ 2018-07-16  2:59 Junwei Zhang
       [not found] ` <1531709980-21298-1-git-send-email-Jerry.Zhang-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Junwei Zhang @ 2018-07-16  2:59 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: Junwei Zhang, christian.koenig-5C7GfCeVMHo

To check rq pointer before adding entity into it.
That avoids NULL pointer access in some case.

Suggested-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Junwei Zhang <Jerry.Zhang@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;
+	}
 	spin_lock(&rq->lock);
 	list_add_tail(&entity->list, &rq->entities);
 	spin_unlock(&rq->lock);
-- 
1.9.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-07-16  9:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-16  2:59 [PATCH] drm/scheduler: add NULL pointer check for run queue Junwei Zhang
     [not found] ` <1531709980-21298-1-git-send-email-Jerry.Zhang-5C7GfCeVMHo@public.gmane.org>
2018-07-16  8:31   ` Christian König
     [not found]     ` <045ffcc7-9b9a-2534-9ebe-295e18ce62e7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2018-07-16  9:01       ` Zhang, Jerry (Junwei)
     [not found]         ` <5B4C5EFD.60301-5C7GfCeVMHo@public.gmane.org>
2018-07-16  9:11           ` Christian König
     [not found]             ` <e2dc7604-e706-c646-bf98-c058d847695e-5C7GfCeVMHo@public.gmane.org>
2018-07-16  9:17               ` Zhang, Jerry (Junwei)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.