aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2022-09-06 19:30:52 +0100
committerGerd Hoffmann <kraxel@redhat.com>2022-09-27 07:32:31 +0200
commit2423ee233872d07c7607ce26f9225c64b30b0dc3 (patch)
treeeee190e8ef0b4085195e854827dcc1af6dd82f9e /hw
parent954cbf7bb53476e99091f9c99a8014af2491f6ef (diff)
downloadqemu-2423ee233872d07c7607ce26f9225c64b30b0dc3.zip
qemu-2423ee233872d07c7607ce26f9225c64b30b0dc3.tar.gz
qemu-2423ee233872d07c7607ce26f9225c64b30b0dc3.tar.bz2
usbnet: Detect short packets as sent by the xHCI controller
The xHCI controller will ignore the endpoint MTU and so may deliver packets of any length. Detect short packets as being any packet that has a length of zero or a length that is not a multiple of the MTU. Signed-off-by: Michael Brown <mcb30@ipxe.org> Message-Id: <20220906183053.3625472-4-mcb30@ipxe.org> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/usb/dev-network.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/usb/dev-network.c b/hw/usb/dev-network.c
index 155df93..9d83974 100644
--- a/hw/usb/dev-network.c
+++ b/hw/usb/dev-network.c
@@ -1211,7 +1211,7 @@ static void usb_net_handle_dataout(USBNetState *s, USBPacket *p)
s->out_ptr += sz;
if (!is_rndis(s)) {
- if (p->iov.size < 64) {
+ if (p->iov.size % 64 || p->iov.size == 0) {
qemu_send_packet(qemu_get_queue(s->nic), s->out_buf, s->out_ptr);
s->out_ptr = 0;
}