FAILED: patch "[PATCH] drm/i915: fix race condition UAF in" failed to apply to 5.4-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 5.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.4.y
git checkout FETCH_HEAD
git cherry-pick -x dc30c011469165d57af9adac5baff7d767d20e5c
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2023041103-fading-coexist-fbc0@gregkh' --subject-prefix 'PATCH 5.4.y' HEAD^..
Possible dependencies:
dc30c0114691 ("drm/i915: fix race condition UAF in i915_perf_add_config_ioctl")2fec539112e8 ("i915/perf: Replace DRM_DEBUG with driver specific drm_dbg call")046d1660daee ("drm/i915/gem: Return an error ptr from context_lookup")a4839cb1137b ("drm/i915: Stop manually RCU banging in reset_stats_ioctl (v2)")651e7d48577a ("drm/i915: replace IS_GEN and friends with GRAPHICS_VER")ec2b1485a065 ("drm/i915/dmc: s/HAS_CSR/HAS_DMC")c24760cf42c3 ("drm/i915/dmc: s/intel_csr/intel_dmc")93e7e61eb448 ("drm/i915/display: rename display version macros")4df9c1ae7a4b ("drm/i915: rename display.version to display.ver")6c51f288b41f ("drm/i915: Don't use {skl, cnl}_hpd_pin() for bxt/glk")0fe6637d9852 ("drm/i915: Restore lost glk ccs w/a")87b8c3bc8d27 ("drm/i915: Restore lost glk FBC 16bpp w/a")2446e1d6433b ("drm/i915/display: Eliminate IS_GEN9_{BC,LP}")9c0fed84d575 ("Merge tag 'drm-intel-next-2021-04-01' of git://anongit.freedesktop.org/drm/drm-intel into drm-next")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From dc30c011469165d57af9adac5baff7d767d20e5c Mon Sep 17 00:00:00 2001
From: Min Li <[email protected]>
Date: Tue, 28 Mar 2023 17:36:27 +0800
Subject: [PATCH] drm/i915: fix race condition UAF in
i915_perf_add_config_ioctl
Userspace can guess the id value and try to race oa_config object creation with config remove, resulting in a use-after-free if we dereference the object after unlocking the metrics_lock. For that reason, unlocking the metrics_lock must be done after we are done dereferencing the object.
drivers/gpu/drm/i915/i915_perf.c +3 -3
@@ -4638,13 +4638,13 @@ int i915_perf_add_config_ioctl(struct drm_device *dev, void *data, err = oa_config->id; goto sysfs_err; } - -mutex_unlock (&perf->metrics_lock); + id = oa_config->id;drm_dbg (&perf->i915->drm,"Added config %s id=%i\n" , oa_config->uuid, oa_config->id); +mutex_unlock (&perf->metrics_lock); -return oa_config->id; +return id; sysfs_err:mutex_unlock (&perf->metrics_lock);