[PATCH] drm/msm: fix possible oops in msm_submitqueues code
Dmitry Baryshkov
dmitry.baryshkov at linaro.org
Sat Sep 25 19:27:54 UTC 2021
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 at 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
More information about the dri-devel
mailing list