Linux virtualization list
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Hu Xinyao" <huxinyao@kylinsec.com.cn>
Cc: virtualization@lists.linux.dev,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Eugenio Perez" <eperezma@redhat.com>
Subject: Re: [PATCH net] vsock/virtio: Fix sock leak on close_timeout race with peer close
Date: Mon, 30 Nov 2026 05:07:08 +0000	[thread overview]
Message-ID: <sashiko-outbox-240385@kernel.org> (raw)
In-Reply-To: <580BB20747AD7900+1796014782.205252-1-huxinyao@kylinsec.com.cn>

> virtio_transport_close() takes a socket reference and schedules
> vsk->close_work with vsk->close_work_scheduled set.
> 
> Once a worker dequeues close_work, WORK_STRUCT_PENDING_BIT is cleared
> before virtio_transport_close_timeout() acquires lock_sock(sk). If a
> peer RST or SHUTDOWN arrives while close_timeout is waiting for the
> socket lock, virtio_transport_do_close(vsk, true) sets SOCK_DONE and
> calls virtio_transport_cancel_close_work(vsk, true), where
> cancel_delayed_work() returns false and skips releasing the close_work
> socket reference and removing the socket.
> 
> When virtio_transport_close_timeout() then acquires lock_sock(sk), it
> sees SOCK_DONE already set, skips virtio_transport_do_close(vsk, false),
> and clears vsk->close_work_scheduled, permanently leaking the socket
> reference (and on OP_RST, leaving the socket in the connected table).
> 
> Call virtio_transport_cancel_close_work(vsk, false) when SOCK_DONE is
> already set so whichever side runs last completes the cleanup.
> 
> Found during a GLM-5.4-assisted code audit and verified manually against
> mainline; compile-tested only (not triggered at runtime).
> 
> Fixes: 06a8fc78367d ("VSOCK: Introduce virtio_vsock_common.ko")
> Cc: stable@vger.kernel.org
> Signed-off-by: Hu Xinyao <huxinyao@kylinsec.com.cn>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/580BB20747AD7900+1796014782.205252-1-huxinyao@kylinsec.com.cn?part=1

  reply	other threads:[~2026-11-30  5:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30  4:59 [PATCH net] vsock/virtio: Fix sock leak on close_timeout race with peer close Hu Xinyao
2026-11-30  5:07 ` sashiko-bot [this message]
2026-11-30 13:23 ` Michal Luczaj

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=sashiko-outbox-240385@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=eperezma@redhat.com \
    --cc=huxinyao@kylinsec.com.cn \
    --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