]> Git Repo - qemu.git/commitdiff
scsi-disk: fix VERIFY for scsi-block
authorPaolo Bonzini <[email protected]>
Fri, 16 Dec 2016 10:10:28 +0000 (11:10 +0100)
committerPaolo Bonzini <[email protected]>
Thu, 22 Dec 2016 15:00:26 +0000 (16:00 +0100)
When a scsi-disk object receives VERIFY command with BYTCHK bit being zero,
scsi_block_is_passthrough returns false and finally makes req being proceeded
by scsi_block_dma_command. Because scsi_block_dma_command has removed process
of VERIFY, QEMU will abort in this function.

Reported-by: Junlian Bell <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
hw/scsi/scsi-disk.c

index a96319138aca7dd0a54a1177f30786b4edebf29b..bdd1e5f86c5bb99fd4eed7366613ef675ecb1ccb 100644 (file)
@@ -2157,6 +2157,13 @@ static int32_t scsi_disk_dma_command(SCSIRequest *req, uint8_t *buf)
         DPRINTF("Write %s(sector %" PRId64 ", count %u)\n",
                 (command & 0xe) == 0xe ? "And Verify " : "",
                 r->req.cmd.lba, len);
+    case VERIFY_10:
+    case VERIFY_12:
+    case VERIFY_16:
+        /* We get here only for BYTCHK == 0x01 and only for scsi-block.
+         * As far as DMA is concerned, we can treat it the same as a write;
+         * scsi_block_do_sgio will send VERIFY commands.
+         */
         if (r->req.cmd.buf[1] & 0xe0) {
             goto illegal_request;
         }
@@ -2712,7 +2719,7 @@ static bool scsi_block_is_passthrough(SCSIDiskState *s, uint8_t *buf)
     case WRITE_VERIFY_16:
         /* MMC writing cannot be done via DMA helpers, because it sometimes
          * involves writing beyond the maximum LBA or to negative LBA (lead-in).
-         * We might use scsi_disk_dma_reqops as long as no writing commands are
+         * We might use scsi_block_dma_reqops as long as no writing commands are
          * seen, but performance usually isn't paramount on optical media.  So,
          * just make scsi-block operate the same as scsi-generic for them.
          */
This page took 0.032193 seconds and 4 git commands to generate.