]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.14-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 6 Oct 2020 16:38:12 +0000 (18:38 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 6 Oct 2020 16:38:12 +0000 (18:38 +0200)
added patches:
drm-syncobj-fix-drm_syncobj_handle_to_fd-refcount-leak.patch

queue-4.14/drm-syncobj-fix-drm_syncobj_handle_to_fd-refcount-leak.patch [new file with mode: 0644]
queue-4.14/series

diff --git a/queue-4.14/drm-syncobj-fix-drm_syncobj_handle_to_fd-refcount-leak.patch b/queue-4.14/drm-syncobj-fix-drm_syncobj_handle_to_fd-refcount-leak.patch
new file mode 100644 (file)
index 0000000..81df2f2
--- /dev/null
@@ -0,0 +1,38 @@
+From stable-owner@vger.kernel.org Tue Oct  6 18:20:14 2020
+From: Giuliano Procida <gprocida@google.com>
+Subject: drm/syncobj: Fix drm_syncobj_handle_to_fd refcount leak
+To: gregkh@linuxfoundation.org, stable@vger.kernel.org
+Message-Id: <20201006162000.1146391-1-gprocida@google.com>
+
+From: Giuliano Procida <gprocida@google.com>
+
+Commit 5fb252cad61f20ae5d5a8b199f6cc4faf6f418e1, a cherry-pick of
+upstream commit e7cdf5c82f1773c3386b93bbcf13b9bfff29fa31, 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: 5fb252cad61f ("drm/syncobj: Stop reusing the same struct file for all syncobj -> fd")
+Signed-off-by: Giuliano Procida <gprocida@google.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/drm_syncobj.c |    1 -
+ 1 file changed, 1 deletion(-)
+
+--- a/drivers/gpu/drm/drm_syncobj.c
++++ b/drivers/gpu/drm/drm_syncobj.c
+@@ -355,7 +355,6 @@ static int drm_syncobj_handle_to_fd(stru
+               return PTR_ERR(file);
+       }
+-      drm_syncobj_get(syncobj);
+       fd_install(fd, file);
+       *p_fd = fd;
index 1aee800717dff6581420a2484afbd163048082c0..94567c69c84187dee50c0eb10a21273160eb0f2b 100644 (file)
@@ -28,3 +28,4 @@ epoll-replace-visited-visited_list-with-generation-count.patch
 epoll-epoll_ctl_add-close-the-race-in-decision-to-take-fast-path.patch
 ep_create_wakeup_source-dentry-name-can-change-under-you.patch
 netfilter-ctnetlink-add-a-range-check-for-l3-l4-protonum.patch
+drm-syncobj-fix-drm_syncobj_handle_to_fd-refcount-leak.patch