Skip to content

Commit 2717b28

Browse files
jmgaocarlescufi
authored andcommitted
usb: usb_dc_native_posix: fix control transfers with data.
Previously, if a control transfer had data, it would be unhandled and left in the usbip socket to be interpreted as the next usbip packet, leading to explosions. Signed-off-by: Josh Gao <[email protected]>
1 parent 377002d commit 2717b28

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/usb/device/usb_dc_native_posix.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,10 @@ int handle_usb_control(struct usbip_header *hdr)
524524
if (ep_cb) {
525525
LOG_DBG("Call ep_cb");
526526
ep_cb(ntohl(hdr->common.ep), USB_DC_EP_SETUP);
527+
if (ntohl(hdr->common.command) == USBIP_CMD_SUBMIT &&
528+
hdr->u.submit.transfer_buffer_length != 0) {
529+
ep_cb(ntohl(hdr->common.ep), USB_DC_EP_DATA_OUT);
530+
}
527531
}
528532

529533
return 0;

0 commit comments

Comments
 (0)