Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Bernard Zhao and committed by
Rob Clark
177d3819 5fddd4f5

+3 -1
+3 -1
drivers/gpu/drm/msm/msm_submitqueue.c
··· 71 71 queue->flags = flags; 72 72 73 73 if (priv->gpu) { 74 - if (prio >= priv->gpu->nr_rings) 74 + if (prio >= priv->gpu->nr_rings) { 75 + kfree(queue); 75 76 return -EINVAL; 77 + } 76 78 77 79 queue->prio = prio; 78 80 }