[Intel-xe] [PATCH] drm/xe: destroy clients engine and vm xarrays on close

Manszewski, Christoph christoph.manszewski at intel.com
Thu Apr 27 13:07:23 UTC 2023


Hi Mika,

On 12.04.2023 13:09, Mika Kuoppala wrote:
> 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 at linux.intel.com>

Reviewed-by: Christoph Manszewski <christoph.manszewski at intel.com>

Christoph
> ---
>   drivers/gpu/drm/xe/xe_device.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
> index 45d6e5ff47fd..30415015db4a 100644
> --- a/drivers/gpu/drm/xe/xe_device.c
> +++ b/drivers/gpu/drm/xe/xe_device.c
> @@ -70,6 +70,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);
>   
> @@ -77,6 +78,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);


More information about the Intel-xe mailing list