[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 04/14] usb-storage: fix request canceling
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 04/14] usb-storage: fix request canceling |
Date: |
Tue, 24 Apr 2012 17:51:21 +0200 |
Little fix for usb packet handling on i/o cancelation. The
usb packet pointer (s->packet) is cleared at the wrong place:
The scsi request cancel handler does it. When a usb packet
is canceled the usb-storage emulation canceles the scsi request
if present. In most cases there is one, so usually s->packet
is cleared as needed even with the code sitting at the wrong
place.
If there is no scsi request in flight s->packet is not cleared
though. The usb-storage emulation will then try to complete an
usb packet which is not in flight any more and thereby trigger
an assert() in the usb core.
Fix this by clearing s->packet at the correct place, which is
the usb packet cancel header.
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/usb/dev-storage.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/hw/usb/dev-storage.c b/hw/usb/dev-storage.c
index d865a5e..3d2f244 100644
--- a/hw/usb/dev-storage.c
+++ b/hw/usb/dev-storage.c
@@ -268,7 +268,6 @@ static void usb_msd_request_cancelled(SCSIRequest *req)
if (req == s->req) {
scsi_req_unref(s->req);
s->req = NULL;
- s->packet = NULL;
s->scsi_len = 0;
}
}
@@ -330,6 +329,9 @@ static void usb_msd_cancel_io(USBDevice *dev, USBPacket *p)
{
MSDState *s = DO_UPCAST(MSDState, dev, dev);
+ assert(s->packet == p);
+ s->packet = NULL;
+
if (s->req) {
scsi_req_cancel(s->req);
}
--
1.7.1
- [Qemu-devel] [PULL 00/14] usb patch queue, Gerd Hoffmann, 2012/04/24
- [Qemu-devel] [PATCH 02/14] usb-ehci: add missing usb_packet_init() call, Gerd Hoffmann, 2012/04/24
- [Qemu-devel] [PATCH 09/14] usb-redir: An interface count of 0 is a valid value, Gerd Hoffmann, 2012/04/24
- [Qemu-devel] [PATCH 05/14] usb-host: don't dereference invalid iovecs, Gerd Hoffmann, 2012/04/24
- [Qemu-devel] [PATCH 06/14] usb-host: fix zero-length packets, Gerd Hoffmann, 2012/04/24
- [Qemu-devel] [PATCH 04/14] usb-storage: fix request canceling,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 03/14] usb-ehci: Ensure frindex writes leave a valid frindex value, Gerd Hoffmann, 2012/04/24
- [Qemu-devel] [PATCH 01/14] usb-ehci: remove hack, Gerd Hoffmann, 2012/04/24
- [Qemu-devel] [PATCH 13/14] usb-uhci: update irq line on reset, Gerd Hoffmann, 2012/04/24
- [Qemu-devel] [PATCH 10/14] usb-redir: Reset device address and speed on disconnect, Gerd Hoffmann, 2012/04/24
- [Qemu-devel] [PATCH 08/14] usb-xhci: fix bit test, Gerd Hoffmann, 2012/04/24
- [Qemu-devel] [PATCH 11/14] usb-redir: Not finding an async urb id is not an error, Gerd Hoffmann, 2012/04/24
- [Qemu-devel] [PATCH 12/14] usb: add serial number generator, Gerd Hoffmann, 2012/04/24
- [Qemu-devel] [PATCH 14/14] usb-host: add timeout handler, Gerd Hoffmann, 2012/04/24