All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/msm: fix possible oops in msm_submitqueues code
@ 2021-09-25 19:27 Dmitry Baryshkov
  0 siblings, 0 replies; only message in thread
From: Dmitry Baryshkov @ 2021-09-25 19:27 UTC (permalink / raw)
  To: Bjorn Andersson, Rob Clark, Sean Paul, Abhinav Kumar
  Cc: Jonathan Marek, Stephen Boyd, David Airlie, Daniel Vetter,
	linux-arm-msm, dri-devel, freedreno

Even without GPU, the ctx->submitqueues list should be properly
initialized. Otherwise msm_submitqueue_close() (which can still be
called even w/o the GPU) will ooops while trying to traverse the list.

Move ctx->submitqueues initialization earlier, before !GPU check.

Fixes: 86c2a0f000c1 ("drm/msm: Small submitqueue creation cleanup")
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
---
 drivers/gpu/drm/msm/msm_submitqueue.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_submitqueue.c b/drivers/gpu/drm/msm/msm_submitqueue.c
index 32a55d81b58b..a0303be05445 100644
--- a/drivers/gpu/drm/msm/msm_submitqueue.c
+++ b/drivers/gpu/drm/msm/msm_submitqueue.c
@@ -128,6 +128,8 @@ int msm_submitqueue_init(struct drm_device *drm, struct msm_file_private *ctx)
 	struct msm_drm_private *priv = drm->dev_private;
 	int default_prio, max_priority;
 
+	INIT_LIST_HEAD(&ctx->submitqueues);
+
 	if (!priv->gpu)
 		return -ENODEV;
 
@@ -140,8 +142,6 @@ int msm_submitqueue_init(struct drm_device *drm, struct msm_file_private *ctx)
 	 */
 	default_prio = DIV_ROUND_UP(max_priority, 2);
 
-	INIT_LIST_HEAD(&ctx->submitqueues);
-
 	rwlock_init(&ctx->queuelock);
 
 	return msm_submitqueue_create(drm, ctx, default_prio, 0, NULL);
-- 
2.33.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-25 19:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-25 19:27 [PATCH] drm/msm: fix possible oops in msm_submitqueues code Dmitry Baryshkov

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.