linux/drivers/usb/usbip
Sam Day c5371e0b91 usbip: vudc: fix NULL deref in vep_dequeue()
vep_alloc_request() wasn't initializing vrequest->udc, so cancellations
on the FunctionFS AIO path were arriving in vep_dequeue without a valid
UDC reference.

Since vrequest->udc is never actually properly used anywhere, we opt to
remove it, and update vep_dequeue to obtain a reference to the udc with
ep_to_vudc(), consistent with the other vep_ ops.

AFAICT this bug has existed for ~10 years. Seems that nobody has really
stressed the FunctionFS AIO path on usbip's vudc.

I tested this fix in a QEMU aarch64 guest driving FunctionFS endpoints
via AIO. Before the fix, running `usbip attach` from the host would
cause the guest to oops with the following backtrace:

Call trace:
 vep_dequeue+0x1c/0xe4 (P)
 usb_ep_dequeue+0x14/0x20
 ffs_aio_cancel+0x24/0x34
 __arm64_sys_io_cancel+0xb0/0x124
 do_el0_svc+0x68/0x100
 el0_svc+0x18/0x5c
 el0t_64_sync_handler+0x98/0xdc
 el0t_64_sync+0x154/0x158

Assisted-by: opencode:openai/gpt-5.5
Cc: stable <stable@kernel.org>
Fixes: b6a0ca1118 ("usbip: vudc: Add UDC specific ops")
Reviewed-by: Igor Kotrasinski <i.kotrasinsk@samsung.com>
Signed-off-by: Sam Day <me@samcday.com>
Link: https://patch.msgid.link/20260626-usbip-vudc-deque-fix-v3-1-98c2dc4d6a48@samcday.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-07-08 13:29:31 +02:00
..
Kconfig usbip: vhci_hcd: reduce CONFIG_USBIP_VHCI_NR_HCS upper bound to 32 2026-05-22 11:34:27 +02:00
Makefile
stub_dev.c USB: usbip: drop redundant device reference 2026-03-18 15:51:44 +01:00
stub_main.c USB: core: Use device_driver directly in struct usb_driver and usb_device_driver 2024-01-04 16:06:32 +01:00
stub_rx.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
stub_tx.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
stub.h
usbip_common.c usbip: validate number_of_packets in usbip_pack_ret_submit() 2026-04-07 13:48:44 +02:00
usbip_common.h kcov: refactor common handle ID into kcov_common_handle_id 2026-05-28 21:24:45 -07:00
usbip_event.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
vhci_hcd.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
vhci_rx.c kcov: refactor common handle ID into kcov_common_handle_id 2026-05-28 21:24:45 -07:00
vhci_sysfs.c USB/Thunderbolt driver changes for 7.2-rc1 2026-06-22 12:09:47 -07:00
vhci_tx.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
vhci.h
vudc_dev.c usbip: vudc: fix NULL deref in vep_dequeue() 2026-07-08 13:29:31 +02:00
vudc_main.c usb: Switch back to struct platform_driver::remove() 2024-10-04 15:13:03 +02:00
vudc_rx.c usb/usbip: Fix v_recv_cmd_submit() to use PIPE_BULK define 2022-11-11 10:28:42 +01:00
vudc_sysfs.c sysfs: treewide: switch back to attribute_group::bin_attrs 2025-06-17 10:44:15 +02:00
vudc_transfer.c usbip: vudc: Fix use after free bug in vudc_remove due to race condition 2026-05-22 11:13:06 +02:00
vudc_tx.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
vudc.h usbip: vudc: fix NULL deref in vep_dequeue() 2026-07-08 13:29:31 +02:00