From: Thomas Huth <thuth@redhat.com>
To: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>,
pbonzini@redhat.com, fam@euphon.net, qemu-devel@nongnu.org
Subject: Re: [PATCH 3/3] scsi-disk: ensure that FORMAT UNIT commands are terminated
Date: Wed, 27 Sep 2023 10:26:41 +0200 [thread overview]
Message-ID: <353ea6dc-bec2-92e9-5452-8ea675e75a63@redhat.com> (raw)
In-Reply-To: <20230913204410.65650-4-mark.cave-ayland@ilande.co.uk>
On 13/09/2023 22.44, Mark Cave-Ayland wrote:
> Otherwise when a FORMAT UNIT command is issued, the SCSI layer can become
> confused because it can find itself in the situation where it thinks there
> is still data to be transferred which can cause the next emulated SCSI
> command to fail.
>
> Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
> Fixes: 6ab71761 ("scsi-disk: add FORMAT UNIT command")
> ---
> hw/scsi/scsi-disk.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
> index e0d79c7966..4484ee8271 100644
> --- a/hw/scsi/scsi-disk.c
> +++ b/hw/scsi/scsi-disk.c
> @@ -1958,6 +1958,10 @@ static void scsi_disk_emulate_write_data(SCSIRequest *req)
> scsi_disk_emulate_write_same(r, r->iov.iov_base);
> break;
>
> + case FORMAT_UNIT:
> + scsi_req_complete(&r->req, GOOD);
> + break;
> +
> default:
> abort();
> }
Thanks! I just double-checked that this fixes the crash that can be
triggered with the reproducer from
https://gitlab.com/qemu-project/qemu/-/issues/1810 :
Tested-by: Thomas Huth <thuth@redhat.com>
prev parent reply other threads:[~2023-09-27 8:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-13 20:44 [PATCH 0/3] esp/scsi: minor fixes Mark Cave-Ayland
2023-09-13 20:44 ` [PATCH 1/3] esp: use correct type for esp_dma_enable() in sysbus_esp_gpio_demux() Mark Cave-Ayland
2023-09-14 6:43 ` Philippe Mathieu-Daudé
2023-09-27 8:28 ` Thomas Huth
2023-09-13 20:44 ` [PATCH 2/3] esp: restrict non-DMA transfer length to that of available data Mark Cave-Ayland
2023-09-27 8:20 ` Thomas Huth
2023-09-13 20:44 ` [PATCH 3/3] scsi-disk: ensure that FORMAT UNIT commands are terminated Mark Cave-Ayland
2023-09-27 8:26 ` Thomas Huth [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=353ea6dc-bec2-92e9-5452-8ea675e75a63@redhat.com \
--to=thuth@redhat.com \
--cc=fam@euphon.net \
--cc=mark.cave-ayland@ilande.co.uk \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/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;
as well as URLs for NNTP newsgroup(s).