mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
drm/syncobj: Fix memory leak in drm_syncobj_find_fence()
Commit18226ba521("drm/syncobj: reject invalid flags in drm_syncobj_find_fence") forgot to take into account the fact that drm_syncobj_find() takes a reference to syncobj and returns early without dropping the reference, leading to memory leaks. Fixes:18226ba521("drm/syncobj: reject invalid flags in drm_syncobj_find_fence") Reported by: Sam Spencer <sam.spencer@arm.com> Signed-off-by: Liviu Dudau <liviu.dudau@arm.com> Acked-by: Erik Kurzinger <ekurzinger@gmail.com> Signed-off-by: Liviu Dudau <liviu.dudau@arm.com> Link: https://lore.kernel.org/all/20260507144425.2488057-1-liviu.dudau@arm.com
This commit is contained in:
@@ -442,13 +442,15 @@ int drm_syncobj_find_fence(struct drm_file *file_private,
|
||||
u64 timeout = nsecs_to_jiffies64(DRM_SYNCOBJ_WAIT_FOR_SUBMIT_TIMEOUT);
|
||||
int ret;
|
||||
|
||||
if (flags & ~DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT)
|
||||
return -EINVAL;
|
||||
|
||||
if (!syncobj)
|
||||
return -ENOENT;
|
||||
|
||||
/* Waiting for userspace with locks help is illegal cause that can
|
||||
if (flags & ~DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT) {
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Waiting for userspace with locks held is illegal cause that can
|
||||
* trivial deadlock with page faults for example. Make lockdep complain
|
||||
* about it early on.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user