From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-547603-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	by finch.gentoo.org (Postfix) with ESMTP id 783F6138558
	for <garchives@archives.gentoo.org>; Sat, 19 Jan 2013 03:48:12 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 0B71821C062;
	Sat, 19 Jan 2013 03:48:02 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 5519621C033
	for <gentoo-commits@lists.gentoo.org>; Sat, 19 Jan 2013 03:48:01 +0000 (UTC)
Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163])
	(using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 41BFB33DAAE
	for <gentoo-commits@lists.gentoo.org>; Sat, 19 Jan 2013 03:48:00 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by hornbill.gentoo.org (Postfix) with ESMTP id 2000BE4092
	for <gentoo-commits@lists.gentoo.org>; Sat, 19 Jan 2013 03:47:58 +0000 (UTC)
From: "Doug Goldstein" <cardoe@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Doug Goldstein" <cardoe@gentoo.org>
Message-ID: <1353533099.f00280ab8e0c4d425bef788c8d0e2653d323130d.cardoe@gentoo>
Subject: [gentoo-commits] proj/qemu-kvm:qemu-kvm-1.1.2-gentoo commit in: hw/usb/
X-VCS-Repository: proj/qemu-kvm
X-VCS-Files: hw/usb/dev-storage.c
X-VCS-Directories: hw/usb/
X-VCS-Committer: cardoe
X-VCS-Committer-Name: Doug Goldstein
X-VCS-Revision: f00280ab8e0c4d425bef788c8d0e2653d323130d
X-VCS-Branch: qemu-kvm-1.1.2-gentoo
Date: Sat, 19 Jan 2013 03:47:58 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: f4672e0d-254c-4425-b11f-c9675ddb0faa
X-Archives-Hash: 5388a3663a18d212c0d229a1fcc488d4

commit:     f00280ab8e0c4d425bef788c8d0e2653d323130d
Author:     Gerd Hoffmann <kraxel <AT> redhat <DOT> com>
AuthorDate: Fri Jul 13 09:38:13 2012 +0000
Commit:     Doug Goldstein <cardoe <AT> gentoo <DOT> org>
CommitDate: Wed Nov 21 21:24:59 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/qemu-kvm.git;a=commit;h=f00280ab

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 <kraxel <AT> redhat.com>
(cherry picked from commit 54414218d78c9d043417b27bb29bd0334b4e3cb5)

---
 hw/usb/dev-storage.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c
index ae22fb1..3a993d3 100644
--- a/hw/usb/dev-storage.c
+++ b/hw/usb/dev-storage.c
@@ -242,6 +242,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);