drm/xe: Fix vm refcount races
authorThomas Hellström <thomas.hellstrom@linux.intel.com>
Thu, 25 May 2023 07:41:44 +0000 (09:41 +0200)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Thu, 21 Dec 2023 16:35:04 +0000 (11:35 -0500)
commit5835dc7fa6e419627e23015c7dbde120a77ce738
tree144c5308795c01c64f40ee44edf4d72f1b6dd5c6
parenta201c6ee37d63e7c0a2973fb7790e94211b7fa83
drm/xe: Fix vm refcount races

Fix a race in xe_vm_lookup() where the vm could disappear after
the lookup mutex unlock but before the get. The xe_vm_get() call
must be inside the lookup mutex.

Also fix a vm close race where multiple callers could potentially
succeed in calling xe_vm_close_and_put().

Reported-by: Oded Gabbay <ogabbay@kernel.org>
Link: https://lists.freedesktop.org/archives/intel-xe/2023-May/004704.html
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230525074144.178961-1-thomas.hellstrom@linux.intel.com
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
drivers/gpu/drm/xe/xe_vm.c