drm/xe: destroy clients engine and vm xarrays on close

xe_file_close cleanups the xarrays but forgets
to destroy them causing a memleak in xarray internals.
Found with kmemleak.

Signed-off-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Reviewed-by: Christoph Manszewski <christoph.manszewski@intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
This commit is contained in:
Mika Kuoppala 2023-04-12 14:09:23 +03:00 committed by Rodrigo Vivi
parent a5cecbac92
commit e3e4964d33

View File

@ -69,6 +69,7 @@ static void xe_file_close(struct drm_device *dev, struct drm_file *file)
xe_engine_put(e);
}
mutex_unlock(&xef->engine.lock);
xa_destroy(&xef->engine.xa);
mutex_destroy(&xef->engine.lock);
device_kill_persistent_engines(xe, xef);
@ -76,6 +77,7 @@ static void xe_file_close(struct drm_device *dev, struct drm_file *file)
xa_for_each(&xef->vm.xa, idx, vm)
xe_vm_close_and_put(vm);
mutex_unlock(&xef->vm.lock);
xa_destroy(&xef->vm.xa);
mutex_destroy(&xef->vm.lock);
kfree(xef);