From: Mika Kuoppala Date: Wed, 12 Apr 2023 11:09:23 +0000 (+0300) Subject: drm/xe: destroy clients engine and vm xarrays on close X-Git-Tag: v6.8-rc1~111^2~7^2~735 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e3e4964d335c73e931ea21c8f318d419d3cdb4cc;p=thirdparty%2Flinux.git 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 Reviewed-by: Christoph Manszewski Reviewed-by: Lucas De Marchi Signed-off-by: Maarten Lankhorst Signed-off-by: Rodrigo Vivi --- diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c index 2f8777f365a42..e686c25a0ad1d 100644 --- a/drivers/gpu/drm/xe/xe_device.c +++ b/drivers/gpu/drm/xe/xe_device.c @@ -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);