]> git.proxmox.com Git - mirror_qemu.git/commitdiff
scsi-disk: ensure that FORMAT UNIT commands are terminated
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Wed, 13 Sep 2023 20:44:10 +0000 (21:44 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 3 Oct 2023 08:29:39 +0000 (10:29 +0200)
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")
Tested-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20230913204410.65650-4-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hw/scsi/scsi-disk.c

index 477ee2bcd47aa1f674411b54367b5cbb15ddd534..6691f5edb841b744a25a090d9c5f2d294a18ec5d 100644 (file)
@@ -1959,6 +1959,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();
     }