Patchwork [2/2] usb-storage: fix SYNCHRONIZE_CACHE

login
register
mail settings
Submitter Gerd Hoffmann
Date July 13, 2012, 9:44 a.m.
Message ID <1342172696-23587-2-git-send-email-kraxel@redhat.com>
Download mbox | patch
Permalink /patch/170838/
State New
Headers show

Comments

Gerd Hoffmann - July 13, 2012, 9:44 a.m.
Commit 59310659073d85745854f2f10c4292555c5a1c51 is incomplete,
we'll arrive in the scsi command complete callback in CSW state
and must handle that case correctly.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb/dev-storage.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Patch

diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c
index f1d8082..97059d3 100644
--- a/hw/usb/dev-storage.c
+++ b/hw/usb/dev-storage.c
@@ -247,6 +247,9 @@  static void usb_msd_command_complete(SCSIRequest *req, uint32_t status, size_t r
                the status read packet.  */
             usb_msd_send_status(s, p);
             s->mode = USB_MSDM_CBW;
+        } else if (s->mode == USB_MSDM_CSW) {
+            usb_msd_send_status(s, p);
+            s->mode = USB_MSDM_CBW;
         } else {
             if (s->data_len) {
                 int len = (p->iov.size - p->result);