Linux virtualization list
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Yuho Choi <oss.patchbox@gmail.com>
Cc: "Michael S . Tsirkin" <mst@redhat.com>,
	"Jason Wang" <jasowangio@gmail.com>,
	"Jens Axboe" <axboe@kernel.dk>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Eugenio Pérez" <eperezma@redhat.com>,
	"Xuan Zhuo" <xuanzhuo@linux.alibaba.com>,
	virtualization@lists.linux.dev, linux-block@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	"Jean-Philippe Brucker" <jpb@kernel.org>,
	"Marcel Holtmann" <marcel@holtmann.org>
Subject: Re: [PATCH v1] virtio_blk: Reset device on probe error paths after DRIVER_OK
Date: Thu, 1 Oct 2026 16:29:16 -0400	[thread overview]
Message-ID: <20261001202916.GC378684@shajnocz.csb> (raw)
In-Reply-To: <20260922211207.523999-1-oss.patchbox@gmail.com>

On Tue, Sep 22, 2026 at 05:11:41PM -0400, Yuho Choi wrote:
> virtblk_probe() marks the device ready before revalidating zones and
> adding the disk, and either of those can fail.  The out_cleanup_disk path
> they take goes on to delete the virtqueues, but nothing tells the device
> to stop first, so it is still live when the rings are freed.
> 
> Reset the device at out_cleanup_disk, which is only reachable after
> virtio_device_ready().  virtblk_remove() and virtblk_freeze_priv() both
> reset before deleting the virtqueues for the same reason.
> 
> Fixes: dbb301f91fc8 ("virtio_blk: add error handling support for add_disk()")
> Signed-off-by: Yuho Choi <oss.patchbox@gmail.com>
> ---
>  drivers/block/virtio_blk.c | 1 +
>  1 file changed, 1 insertion(+)

Thanks for the fix!

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

> 
> diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
> index 32bf3ba07a9dc..ed97dafebe164 100644
> --- a/drivers/block/virtio_blk.c
> +++ b/drivers/block/virtio_blk.c
> @@ -1547,6 +1547,7 @@ static int virtblk_probe(struct virtio_device *vdev)
>  	return 0;
>  
>  out_cleanup_disk:
> +	virtio_reset_device(vdev);
>  	put_disk(vblk->disk);
>  out_free_tags:
>  	blk_mq_free_tag_set(&vblk->tag_set);
> -- 
> 2.43.0
> 


      parent reply	other threads:[~2026-10-01 20:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-22 21:11 [PATCH v1] virtio_blk: Reset device on probe error paths after DRIVER_OK Yuho Choi
2026-09-22 21:20 ` sashiko-bot
2026-10-01 20:29 ` 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=20261001202916.GC378684@shajnocz.csb \
    --to=stefanha@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=eperezma@redhat.com \
    --cc=jasowangio@gmail.com \
    --cc=jpb@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=mst@redhat.com \
    --cc=oss.patchbox@gmail.com \
    --cc=pbonzini@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=virtualization@lists.linux.dev \
    --cc=xuanzhuo@linux.alibaba.com \
    /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