[PATCH 0/4] drm/xe: Fix resource leaks in bo init and dma-buf paths

Shuicheng Lin
2026-04-07T20:20:31Z

Fix several resource leaks in the xe driver's buffer object
initialization and dma-buf import paths:

Patches 1-2 fix xe_bo_init_locked() where two early validation error
paths return without freeing a caller-provided bo, violating the
documented contract that bo is freed on failure.

Patch 3 fixes xe_dma_buf_init_obj() where the pre-allocated storage bo
is leaked when drm_gpuvm_resv_object_alloc() fails.

Patch 4 fixes xe_gem_prime_import() where the dma-buf attachment is
leaked when xe_dma_buf_init_obj() fails.

Shuicheng Lin (4):
drm/xe/bo: Fix bo leak on unaligned size validation in
xe_bo_init_locked()
drm/xe/bo: Fix bo leak on GGTT flag validation in xe_bo_init_locked()
drm/xe: Fix bo leak in xe_dma_buf_init_obj() on allocation failure
drm/xe: Fix dma-buf attachment leak in xe_gem_prime_import()

drivers/gpu/drm/xe/xe_bo.c | 8 ++++++--
drivers/gpu/drm/xe/xe_dma_buf.c | 15 ++++++++++-----
2 files changed, 16 insertions(+), 7 deletions(-)

--
2.43.0