From: Gerd Hoffmann Date: Fri, 13 Jul 2012 09:38:13 +0000 (+0200) Subject: usb-storage: fix SYNCHRONIZE_CACHE X-Git-Tag: v1.2.0-rc0~76^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=54414218d78c9d043417b27bb29bd0334b4e3cb5;p=thirdparty%2Fqemu.git usb-storage: fix SYNCHRONIZE_CACHE 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 --- diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c index 976fe1acc50..ff48d91049a 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);