Skip to content
Snippets Groups Projects
Commit 2423ee23 authored by Michael Brown's avatar Michael Brown Committed by Gerd Hoffmann
Browse files

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: default avatarMichael Brown <mcb30@ipxe.org>
Message-Id: <20220906183053.3625472-4-mcb30@ipxe.org>
Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
parent 954cbf7b
No related branches found
No related tags found
No related merge requests found
......@@ -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;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment