summaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorBernard Zhao <bernard@vivo.com>2020-06-12 09:23:49 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-07-22 09:32:51 +0200
commit5d6891a5a627c346e11200ed5f15ed325dfead26 (patch)
tree78dccde934ef0281e8e502e1917e7c4f2863c7b8 /drivers/gpu
parentf608a77e0cc940ffa74f758ae797d50d68d88d30 (diff)
downloadlinux-stable-5d6891a5a627c346e11200ed5f15ed325dfead26.tar.gz
linux-stable-5d6891a5a627c346e11200ed5f15ed325dfead26.tar.bz2
linux-stable-5d6891a5a627c346e11200ed5f15ed325dfead26.zip
drm/msm: fix potential memleak in error branch
[ Upstream commit 177d3819633cd520e3f95df541a04644aab4c657 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/gpu')
-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;
}