提交 0b377169 编写于 作者: G Gerd Hoffmann

usb-host: fix zero-length packets

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: NGerd Hoffmann <kraxel@redhat.com>
上级 818d59dc
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册