summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/drm_gem.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2020-03-20 16:23:34 +0300
committerEmil Velikov <emil.l.velikov@gmail.com>2020-05-17 19:14:38 +0300
commitec0bb482de0ad5e4aba2a4537ea53eaeb77d11a6 (patch)
tree91e698fcc1e74225da67cd572aa02ccfb77be1a9 /drivers/gpu/drm/drm_gem.c
parent5fa63f0773323b1d028f2da5c94b8f3e38619b69 (diff)
downloadlinux-ec0bb482de0ad5e4aba2a4537ea53eaeb77d11a6.tar.xz
drm/gem: Fix a leak in drm_gem_objects_lookup()
If the "handles" allocation or the copy_from_user() fails then we leak "objs". It's supposed to be freed in panfrost_job_cleanup(). Fixes: c117aa4d8701 ("drm: Add a drm_gem_objects_lookup helper") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200320132334.GC95012@mwanda
Diffstat (limited to 'drivers/gpu/drm/drm_gem.c')
-rw-r--r--drivers/gpu/drm/drm_gem.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
index 7bf628e13023..d6ef48bc7a7b 100644
--- a/drivers/gpu/drm/drm_gem.c
+++ b/drivers/gpu/drm/drm_gem.c
@@ -709,6 +709,8 @@ int drm_gem_objects_lookup(struct drm_file *filp, void __user *bo_handles,
if (!objs)
return -ENOMEM;
+ *objs_out = objs;
+
handles = kvmalloc_array(count, sizeof(u32), GFP_KERNEL);
if (!handles) {
ret = -ENOMEM;
@@ -722,8 +724,6 @@ int drm_gem_objects_lookup(struct drm_file *filp, void __user *bo_handles,
}
ret = objects_lookup(filp, handles, count, objs);
- *objs_out = objs;
-
out:
kvfree(handles);
return ret;