mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 18:43:33 +02:00
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: c117aa4d87 ("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
This commit is contained in:
parent
5fa63f0773
commit
ec0bb482de
|
|
@ -709,6 +709,8 @@ int drm_gem_objects_lookup(struct drm_file *filp, void __user *bo_handles,
|
||||||
if (!objs)
|
if (!objs)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
|
*objs_out = objs;
|
||||||
|
|
||||||
handles = kvmalloc_array(count, sizeof(u32), GFP_KERNEL);
|
handles = kvmalloc_array(count, sizeof(u32), GFP_KERNEL);
|
||||||
if (!handles) {
|
if (!handles) {
|
||||||
ret = -ENOMEM;
|
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);
|
ret = objects_lookup(filp, handles, count, objs);
|
||||||
*objs_out = objs;
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
kvfree(handles);
|
kvfree(handles);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user