Skip to content
Commit 328ec628 authored by Giuliano Procida's avatar Giuliano Procida Committed by Greg Kroah-Hartman
Browse files

drm/syncobj: Fix drm_syncobj_handle_to_fd refcount leak

Commit 5fb252ca, a cherry-pick of
upstream commit e7cdf5c8, introduced a
refcount imbalance and thus a struct drm_syncobj object leak which can
be triggered with DRM_IOCTL_SYNCOBJ_HANDLE_TO_FD.

The function drm_syncobj_handle_to_fd first calls drm_syncobj_find
which increments the refcount of the object on success. In all of the
drm_syncobj_handle_to_fd error paths, the refcount is decremented, but
in the success path the refcount should remain at +1 as the struct
drm_syncobj now belongs to the newly opened file. Instead, the
refcount was incremented again to +2.

Fixes: 5fb252ca

 ("drm/syncobj: Stop reusing the same struct file for all syncobj -> fd")
Signed-off-by: default avatarGiuliano Procida <gprocida@google.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 60634d81
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment