mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mike Christie <michael.christie@oracle.com>
To: Yuho Choi <oss.patchbox@gmail.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Jason Wang <jasowangio@gmail.com>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"Eugenio Pérez" <eperezma@redhat.com>,
	virtualization@lists.linux.dev, kvm@vger.kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] vhost-scsi: do not validate vrings during endpoint teardown
Date: Sun, 8 Nov 2026 13:05:23 -0600	[thread overview]
Message-ID: <add2bfe5-0d8a-4b64-a8dd-5e02be00e425@oracle.com> (raw)
In-Reply-To: <20261106054811.281798-2-oss.patchbox@gmail.com>

On 11/5/26 11:48 PM, Yuho Choi wrote:
> vhost_scsi_clear_endpoint() checks every virtqueue with vhost_vq_access_ok() before disabling the backends and waiting for in-flight SCSI commands. If that check fails, endpoint teardown is skipped. vhost_scsi_release() ignores the error and
> 
> 
> vhost_scsi_clear_endpoint() checks every virtqueue with
> vhost_vq_access_ok() before disabling the backends and waiting for
> in-flight SCSI commands.  If that check fails, endpoint teardown is
> skipped.
> 
> vhost_scsi_release() ignores the error and frees the vhost-scsi state.
> vhost_dev_stop() drains vhost work, but it does not wait for commands
> owned by the target core.  A later command or TMF completion can therefore
> dereference its saved virtqueue pointer after the virtqueue has been freed.
> 
> Vring access is not a prerequisite for tearing an endpoint down.  Remove
> the check so teardown always disables the backends and waits for in-flight
> commands before releasing their state.
> 
Can you describe the bug a little more?

If we have done vhost_scsi_set_endpoint successfully, are you saying a later
call to vhost_scsi_clear_endpoint could fail the vhost_vq_access_ok check
and not teardown the endpoint?

Or are you saying that even if we never did vhost_scsi_set_endpoint then
when vhost_scsi_release is called, a command could be running in the
vhost-scsi driver and so we need to do something? Is the something a
"vhost_vq_set_backend(vq, NULL)" and vhost_scsi_flush(vs)?



      reply	other threads:[~2026-11-08 19:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-06  5:48 Yuho Choi
2026-11-08 19:05 ` Mike Christie [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=add2bfe5-0d8a-4b64-a8dd-5e02be00e425@oracle.com \
    --to=michael.christie@oracle.com \
    --cc=eperezma@redhat.com \
    --cc=jasowangio@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=oss.patchbox@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=stefanha@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®