[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 06/14] usb-host: fix zero-length packets
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 06/14] usb-host: fix zero-length packets |
Date: |
Tue, 24 Apr 2012 17:51:23 +0200 |
usb-host optimizes away zero-length packets by not entering the
processing loop at all. Which isn't correct, we should submit a
zero-length urb to the host devicein that case. This patch makes
sure we run the processing loop at least once.
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/usb/host-linux.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/hw/usb/host-linux.c b/hw/usb/host-linux.c
index c3684c8..048f8ff 100644
--- a/hw/usb/host-linux.c
+++ b/hw/usb/host-linux.c
@@ -887,8 +887,8 @@ static int usb_host_handle_data(USBDevice *dev, USBPacket
*p)
prem = 0;
pbuf = NULL;
rem = p->iov.size;
- while (rem) {
- if (prem == 0) {
+ do {
+ if (prem == 0 && rem > 0) {
assert(v < p->iov.niov);
prem = p->iov.iov[v].iov_len;
pbuf = p->iov.iov[v].iov_base;
@@ -938,7 +938,7 @@ static int usb_host_handle_data(USBDevice *dev, USBPacket
*p)
return USB_RET_STALL;
}
}
- }
+ } while (rem > 0);
return USB_RET_ASYNC;
}
--
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 <=
- [Qemu-devel] [PATCH 04/14] usb-storage: fix request canceling, Gerd Hoffmann, 2012/04/24
- [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