Skip to content

drm/virtio: fix GEM object leaks on error paths

Junrui Luo b4-sent dri-devel lkml virtualization 2 versions – Applied

Status from this message: Applied to misc-fixes, thanks!

Get series with b4
b4 am [email protected] change-id 20260815-virtgpu-gem-create-leak-8620531cd3d8

Versions newest first · linked by author and title

  1. v2 Latest4 patches 1 replyApplied
  2. v11 patch 2 repliesSuperseded

Changes in v2 from the cover letter

- Add patches 2-4 covering the other occurrences reported by the bot
(Dmitry Osipenko)
- Link to v1: https://lore.kernel.org/r/[email protected]

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/4drm/virtio: fix object leak when drm_gem_handle_create() failsdrivers/gpu/drm/virtio/virtgpu_gem.c+1 -10 replies
2/4drm/virtio: fix object leak in virtio_gpu_resource_create_ioctl()drivers/gpu/drm/virtio/virtgpu_ioctl.c+1 -10 replies
3/4drm/virtio: fix object leaks in virtio_gpu_resource_create_blob_ioctl()drivers/gpu/drm/virtio/virtgpu_ioctl.c+2 -20 replies
4/4drm/virtio: release the GEM object on virtio_gpu_vram_create() errorsdrivers/gpu/drm/virtio/virtgpu_vram.c+9 -80 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/4] drm/virtio: fix GEM object leaks on error paths

v1 fixed one drm_gem_object_release() misuse in virtio_gpu_gem_create(). Dmitry asked for the other occurrences the Sashiko bot pointed at [1], so v2 turns it into a series.

Patches 1-3 replace drm_gem_object_release() with drm_gem_object_put() on the GEM creation error paths. Patch 1 is unchanged from v1.

Patch 4 adds the missing drm_gem_object_release() before kfree(vram) in virtio_gpu_vram_create().

Only compile-tested (x86_64, CONFIG_DRM_VIRTIO_GPU=m).

[1] https://lore.kernel.org/all/[email protected]/

Changes in v2:
- Add patches 2-4 covering the other occurrences reported by the bot
(Dmitry Osipenko)
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Junrui Luo (4):
drm/virtio: fix object leak when drm_gem_handle_create() fails drm/virtio: fix object leak in virtio_gpu_resource_create_ioctl() drm/virtio: fix object leaks in virtio_gpu_resource_create_blob_ioctl() drm/virtio: release the GEM object on virtio_gpu_vram_create() errors

 drivers/gpu/drm/virtio/virtgpu_gem.c   |  2 +-
 drivers/gpu/drm/virtio/virtgpu_ioctl.c |  6 +++---
 drivers/gpu/drm/virtio/virtgpu_vram.c  | 17 +++++++++--------
 3 files changed, 13 insertions(+), 12 deletions(-)

---
base-commit: 587858367581b9c55c3690f4e63382ad622719d4
change-id: 20260915-fixes-8c6917e90665

Best regards,

Signature · 1 line
Junrui Luo <[email protected]>