summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBernard Zhao <bernard@vivo.com>2020-06-12 03:23:49 +0200
committerRob Clark <robdclark@chromium.org>2020-06-12 05:06:12 +0200
commit177d3819633cd520e3f95df541a04644aab4c657 (patch)
tree772b4d3fbd3022d8efa50e60e9126b987f07e822 /drivers
parentdrm/msm/dpu: request for display color blocks based on hw catalog entry (diff)
downloadlinux-177d3819633cd520e3f95df541a04644aab4c657.tar.xz
linux-177d3819633cd520e3f95df541a04644aab4c657.zip
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 <bernard@vivo.com> [trivial commit msg fixup] Signed-off-by: Rob Clark <robdclark@chromium.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/msm/msm_submitqueue.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpu/drm/msm/msm_submitqueue.c b/drivers/gpu/drm/msm/msm_submitqueue.c
index 001fbf537440..a1d94be7883a 100644
--- a/drivers/gpu/drm/msm/msm_submitqueue.c
+++ b/drivers/gpu/drm/msm/msm_submitqueue.c
@@ -71,8 +71,10 @@ int msm_submitqueue_create(struct drm_device *drm, struct msm_file_private *ctx,
queue->flags = flags;
if (priv->gpu) {
- if (prio >= priv->gpu->nr_rings)
+ if (prio >= priv->gpu->nr_rings) {
+ kfree(queue);
return -EINVAL;
+ }
queue->prio = prio;
}