Linux virtualization list
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Junrui Luo" <moonafterrain@outlook.com>
Cc: "Eugenio Perez" <eperezma@redhat.com>,
	dri-devel@lists.freedesktop.org, virtualization@lists.linux.dev,
	"Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [PATCH v2 1/4] drm/virtio: fix object leak when drm_gem_handle_create() fails
Date: Tue, 15 Sep 2026 07:46:33 +0000	[thread overview]
Message-ID: <20260915074633.DC21C1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260915-fixes-v2-1-a0d799e4db66@outlook.com>

> From: Junrui Luo <moonafterrain@outlook.com>
> 
> virtio_gpu_gem_create() owns the reference taken by
> virtio_gpu_object_create(). On the drm_gem_handle_create() error path it
> calls drm_gem_object_release() instead of dropping that reference.
> 
> drm_gem_object_release() is the inverse of drm_gem_object_init() and does
> not touch the reference count or call obj->funcs->free(), so it is only
> correct as the last step of a destructor, as in
> virtio_gpu_cleanup_object(). Using it here leaves the bo at refcount 1
> with no remaining reference, so virtio_gpu_free_object() never runs and
> the shmem pages, sg table and virtio_gpu_object are leaked. Since
> virtio_gpu_object_create() has already set bo->created,
> VIRTIO_GPU_CMD_RESOURCE_UNREF is not queued either, leaking the host-side
> resource and the resource id.
> 
> drm_gem_handle_create_tail() drops the handle reference on all of its
> internal error paths, so the caller only has to drop its own. Use
> drm_gem_object_put(), matching the success path below.
> 
> Fixes: dc5698e80cf7 ("Add virtio gpu driver.")
> Reported-by: Yuhao Jiang <danisjiang@gmail.com>
> Assisted-by: Claude:claude-opus-5
> Signed-off-by: Junrui Luo <moonafterrain@outlook.com>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260915-fixes-v2-0-a0d799e4db66@outlook.com?part=1


  reply	other threads:[~2026-09-15  7:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-15  7:39 [PATCH v2 0/4] drm/virtio: fix GEM object leaks on error paths Junrui Luo via B4 Relay
2026-09-15  7:39 ` [PATCH v2 1/4] drm/virtio: fix object leak when drm_gem_handle_create() fails Junrui Luo via B4 Relay
2026-09-15  7:46   ` sashiko-bot [this message]
2026-09-15  7:39 ` [PATCH v2 2/4] drm/virtio: fix object leak in virtio_gpu_resource_create_ioctl() Junrui Luo via B4 Relay
2026-09-15  7:48   ` sashiko-bot
2026-09-15  7:39 ` [PATCH v2 3/4] drm/virtio: fix object leaks in virtio_gpu_resource_create_blob_ioctl() Junrui Luo via B4 Relay
2026-09-15  7:48   ` sashiko-bot
2026-09-15  7:39 ` [PATCH v2 4/4] drm/virtio: release the GEM object on virtio_gpu_vram_create() errors Junrui Luo via B4 Relay
2026-09-15  7:50   ` sashiko-bot
2026-09-20 18:18 ` [PATCH v2 0/4] drm/virtio: fix GEM object leaks on error paths Dmitry Osipenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260915074633.DC21C1F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=eperezma@redhat.com \
    --cc=moonafterrain@outlook.com \
    --cc=mst@redhat.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=virtualization@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox