cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
0a122b
From 496cf1296786c104f08a04263d59abf701759374 Mon Sep 17 00:00:00 2001
0a122b
From: Paolo Bonzini <pbonzini@redhat.com>
0a122b
Date: Mon, 20 Jan 2014 12:49:44 +0100
0a122b
Subject: [PATCH 28/34] scsi-bus: fix transfer length and direction for VERIFY command
0a122b
MIME-Version: 1.0
0a122b
Content-Type: text/plain; charset=UTF-8
0a122b
Content-Transfer-Encoding: 8bit
0a122b
0a122b
RH-Author: Paolo Bonzini <pbonzini@redhat.com>
0a122b
Message-id: <1390222185-24969-2-git-send-email-pbonzini@redhat.com>
0a122b
Patchwork-id: 56833
0a122b
O-Subject: [RHEL 7.0 qemu-kvm PATCH 1/2] scsi-bus: fix transfer length and direction for VERIFY command
0a122b
Bugzilla: 1035644
0a122b
RH-Acked-by: Fam Zheng <famz@redhat.com>
0a122b
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
0a122b
RH-Acked-by: Orit Wasserman <owasserm@redhat.com>
0a122b
0a122b
The amount of bytes to transfer depends on the BYTCHK field.
0a122b
If any data is transferred, it is sent to the device.
0a122b
0a122b
Cc: qemu-stable@nongnu.org
0a122b
Tested-by: Hervé Poussineau <hpoussin@reactos.org>
0a122b
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
0a122b
(cherry picked from commit d12ad44cc4cc9142179e64295608611f118b8ad8)
0a122b
---
0a122b
 hw/scsi/scsi-bus.c | 14 +++++++++++++-
0a122b
 1 file changed, 13 insertions(+), 1 deletion(-)
0a122b
0a122b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
---
0a122b
 hw/scsi/scsi-bus.c |   14 +++++++++++++-
0a122b
 1 files changed, 13 insertions(+), 1 deletions(-)
0a122b
0a122b
diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
0a122b
index 6733c1a..0f02208 100644
0a122b
--- a/hw/scsi/scsi-bus.c
0a122b
+++ b/hw/scsi/scsi-bus.c
0a122b
@@ -874,7 +874,6 @@ static int scsi_req_length(SCSICommand *cmd, SCSIDevice *dev, uint8_t *buf)
0a122b
     case RELEASE:
0a122b
     case ERASE:
0a122b
     case ALLOW_MEDIUM_REMOVAL:
0a122b
-    case VERIFY_10:
0a122b
     case SEEK_10:
0a122b
     case SYNCHRONIZE_CACHE:
0a122b
     case SYNCHRONIZE_CACHE_16:
0a122b
@@ -891,6 +890,16 @@ static int scsi_req_length(SCSICommand *cmd, SCSIDevice *dev, uint8_t *buf)
0a122b
     case ALLOW_OVERWRITE:
0a122b
         cmd->xfer = 0;
0a122b
         break;
0a122b
+    case VERIFY_10:
0a122b
+    case VERIFY_12:
0a122b
+    case VERIFY_16:
0a122b
+        if ((buf[1] & 2) == 0) {
0a122b
+            cmd->xfer = 0;
0a122b
+        } else if ((buf[1] & 4) == 1) {
0a122b
+            cmd->xfer = 1;
0a122b
+        }
0a122b
+        cmd->xfer *= dev->blocksize;
0a122b
+        break;
0a122b
     case MODE_SENSE:
0a122b
         break;
0a122b
     case WRITE_SAME_10:
0a122b
@@ -1088,6 +1097,9 @@ static void scsi_cmd_xfer_mode(SCSICommand *cmd)
0a122b
     case WRITE_VERIFY_12:
0a122b
     case WRITE_16:
0a122b
     case WRITE_VERIFY_16:
0a122b
+    case VERIFY_10:
0a122b
+    case VERIFY_12:
0a122b
+    case VERIFY_16:
0a122b
     case COPY:
0a122b
     case COPY_VERIFY:
0a122b
     case COMPARE:
0a122b
-- 
0a122b
1.7.1
0a122b