Skip to content

Commit 177d381

Browse files
Bernard Zhaorobclark
authored andcommitted
drm/msm: fix potential memleak in error branch
In function msm_submitqueue_create, the queue is a local variable, in return -EINVAL branch, queue didn`t add to ctx`s list yet, and also didn`t kfree, this maybe bring in potential memleak. Signed-off-by: Bernard Zhao <[email protected]> [trivial commit msg fixup] Signed-off-by: Rob Clark <[email protected]>
1 parent 5fddd4f commit 177d381

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/gpu/drm/msm/msm_submitqueue.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,10 @@ int msm_submitqueue_create(struct drm_device *drm, struct msm_file_private *ctx,
7171
queue->flags = flags;
7272

7373
if (priv->gpu) {
74-
if (prio >= priv->gpu->nr_rings)
74+
if (prio >= priv->gpu->nr_rings) {
75+
kfree(queue);
7576
return -EINVAL;
77+
}
7678

7779
queue->prio = prio;
7880
}

0 commit comments

Comments
 (0)