]> git.baikalelectronics.ru Git - kernel.git/commit
drm/syncobj: Fix use-after-free
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 19 Jan 2021 13:03:18 +0000 (14:03 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 20 Jan 2021 09:28:39 +0000 (10:28 +0100)
commitc35bb3487648bd1843fbac1b4975f4457a7c028d
treef293a8ba69184675d764d4497c77a7cacf189422
parentf698cd4cf55ea2b6a3cc04b353d80aa93289d7e9
drm/syncobj: Fix use-after-free

While reviewing Christian's annotation patch I noticed that we have a
user-after-free for the WAIT_FOR_SUBMIT case: We drop the syncobj
reference before we've completed the waiting.

Of course usually there's nothing bad happening here since userspace
keeps the reference, but we can't rely on userspace to play nice here!

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Fixes: 13e02f5bd2d0 ("drm/syncobj: use the timeline point in drm_syncobj_find_fence v4")
Reviewed-by: Christian König <christian.koenig@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: dri-devel@lists.freedesktop.org
Cc: <stable@vger.kernel.org> # v5.2+
Link: https://patchwork.freedesktop.org/patch/msgid/20210119130318.615145-1-daniel.vetter@ffwll.ch
drivers/gpu/drm/drm_syncobj.c