From: Stefan Hajnoczi <stefanha@redhat.com>
To: Jia Jia <physicalmtea@gmail.com>
Cc: mst@redhat.com, jasowang@redhat.com, michael.christie@oracle.com,
pbonzini@redhat.com, eperezma@redhat.com,
virtualization@lists.linux.dev, kvm@vger.kernel.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] vhost-scsi: serialize completion notification with callfd updates
Date: Wed, 12 Aug 2026 14:48:45 -0400 [thread overview]
Message-ID: <20260812184845.GA259475@fedora> (raw)
In-Reply-To: <20260806065143.55584-1-physicalmtea@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1207 bytes --]
On Thu, Aug 06, 2026 at 02:51:43PM +0800, Jia Jia wrote:
> vhost_scsi_complete_cmd_work() drops the virtqueue mutex before calling
> vhost_signal(). VHOST_SET_VRING_CALL replaces call_ctx.ctx and releases the
> old eventfd_ctx while holding the same mutex. vhost_signal() reads the call
> context before and after vhost_notify(), so a concurrent callfd update can
> make it signal a freed context or NULL.
>
> KASAN reported the use through:
>
> eventfd_signal_mask
> vhost_signal
> vhost_scsi_complete_cmd_work
>
> The context was released through:
>
> eventfd_ctx_put
> vhost_vring_ioctl
> vhost_scsi_ioctl
>
> Keep the mutex held through vhost_signal() so completion notification and
> callfd updates are serialized.
>
> Fixes: 057cbf49a1f0 ("tcm_vhost: Initial merge for vhost level target fabric driver")
> Link: https://lore.kernel.org/r/20260720085306.1519294-1-physicalmtea@gmail.com
> Signed-off-by: Jia Jia <physicalmtea@gmail.com>
> ---
> Changes since RFC:
> - Send as a non-RFC v2.
> - Add Fixes and Link tags.
>
> drivers/vhost/scsi.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
prev parent reply other threads:[~2026-08-12 18:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-06 6:51 [PATCH v2] vhost-scsi: serialize completion notification with callfd updates Jia Jia
2026-08-12 18:48 ` Stefan Hajnoczi [this message]
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=20260812184845.GA259475@fedora \
--to=stefanha@redhat.com \
--cc=eperezma@redhat.com \
--cc=jasowang@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michael.christie@oracle.com \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=physicalmtea@gmail.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.