]> git.baikalelectronics.ru Git - kernel.git/commit
drm/i915: Avoid potential vm use-after-free
authorRob Clark <robdclark@chromium.org>
Thu, 19 Jan 2023 17:32:58 +0000 (09:32 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Feb 2023 10:28:23 +0000 (11:28 +0100)
commit3bbdd70fca889d669cd39d61b129a1bbfc5ff6e8
treef54c0b2329ab92a2e127a349791ba1cddbb2ffcf
parentf684469be6ec79aab28c55a76b3ebb6fe93387f1
drm/i915: Avoid potential vm use-after-free

commit 41d419382ec7e257e54b7b6ff0d3623aafb1316d upstream.

Adding the vm to the vm_xa table makes it visible to userspace, which
could try to race with us to close the vm.  So we need to take our extra
reference before putting it in the table.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Fixes: fe86f7c1f668 ("drm/i915: Drop __rcu from gem_context->vm")
Cc: <stable@vger.kernel.org> # v5.16+
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230119173321.2825472-1-robdclark@gmail.com
(cherry picked from commit 99343c46d4e2b34c285d3d5f68ff04274c2f9fb4)
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/i915/gem/i915_gem_context.c