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

Junrui Luo via B4 Relay posted 4 patches 1 week, 2 days ago
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(-)
[PATCH v2 0/4] drm/virtio: fix GEM object leaks on error paths
Posted by Junrui Luo via B4 Relay 1 week, 2 days ago
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/55240372-c265-4b38-be94-f29a58ddbb22@collabora.com/

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/20260815-virtgpu-gem-create-leak-v1-1-a4e9fb18caa3@outlook.com

Signed-off-by: Junrui Luo <moonafterrain@outlook.com>
---
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,
-- 
Junrui Luo <moonafterrain@outlook.com>
Re: [PATCH v2 0/4] drm/virtio: fix GEM object leaks on error paths
Posted by Dmitry Osipenko 4 days, 13 hours ago
On 9/15/26 10:39, Junrui Luo via B4 Relay wrote:
> 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/55240372-c265-4b38-be94-f29a58ddbb22@collabora.com/
> 
> 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/20260815-virtgpu-gem-create-leak-v1-1-a4e9fb18caa3@outlook.com
> 
> Signed-off-by: Junrui Luo <moonafterrain@outlook.com>
> ---
> 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,

Applied to misc-fixes, thanks!

-- 
Best regards,
Dmitry