drm/msm: fix potential memleak in error branch
PATCH 1/1 drm/msm: fix potential memleak in error branch
In fucntin msm_submitqueue_create, the queue is a local variable, in return -EINVAL branch, queue didnt add to ctxs list yet, and also didn`t kfree, this maybe bring in potential memleak.
Signed-off-by Bernard Zhao <[email protected]>
--- drivers/gpu/drm/msm/msm_submitqueue.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/msm_submitqueue.c +3 -1
@@ -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; }
Signature · 1 line
2.17.1