From: sashiko-bot@kernel.org
To: "Bartłomiej Dmitruk" <bartlomiej.dmitruk@isec.pl>
Cc: "Eugenio Perez" <eperezma@redhat.com>,
linux-hyperv@vger.kernel.org,
"Michael S. Tsirkin" <mst@redhat.com>,
virtualization@lists.linux.dev
Subject: Re: [PATCH v2] vsock/hv_sock: don't finish a connection on a socket being released
Date: Sat, 19 Sep 2026 12:43:42 +0000 [thread overview]
Message-ID: <20260919124342.B35AB1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260919123128.28868-1-bartlomiej.dmitruk@isec.pl>
> hvs_open_connection() only checks sk->sk_state (TCP_LISTEN for a
> host-initiated connection, TCP_SYN_SENT for a guest-initiated one) before
> proceeding. __vsock_release() sets sk->sk_shutdown = SHUTDOWN_MASK and, for
> a listener, flushes the accept queue, while leaving sk_state unchanged. A
> VMBUS channel offer that races close() therefore still passes the state
> check and either enqueues a child onto the already-flushed accept queue
> (conn_from_host) or completes a connection on a socket being torn down
> (!conn_from_host); the socket and its VMBUS channel then leak.
>
> The virtio transport guards the listener case in
> virtio_transport_recv_listen(); hv_sock has no equivalent. Add a
> sk_shutdown == SHUTDOWN_MASK check to the common path right after
> lock_sock(), so both the host- and guest-initiated paths bail out.
> hv_sock holds lock_sock(sk) across hvs_open_connection(), so the check is
> race-free.
>
> This was found by code inspection; I do not have Hyper-V hardware to test on.
>
> Fixes: ae0078fcf0a5 ("hv_sock: implements Hyper-V transport for Virtual Sockets (AF_VSOCK)")
> Signed-off-by: Bartłomiej Dmitruk <bartlomiej.dmitruk@isec.pl>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260919123128.28868-1-bartlomiej.dmitruk@isec.pl?part=1
next prev parent reply other threads:[~2026-09-19 12:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-19 12:31 [PATCH v2] vsock/hv_sock: don't finish a connection on a socket being released Bartłomiej Dmitruk
2026-09-19 12:43 ` sashiko-bot [this message]
2026-09-22 12:33 ` Stefano Garzarella
2026-09-23 12:46 ` netdev-bot+sashiko
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=20260919124342.B35AB1F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bartlomiej.dmitruk@isec.pl \
--cc=eperezma@redhat.com \
--cc=linux-hyperv@vger.kernel.org \
--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