usbip: vudc: get vudc from endpoint in vep_dequeue
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): 2026061502-rants-doing-407e@gregkh
PATCH 1/1 usbip: vudc: get vudc from endpoint in vep_dequeue
vep_dequeue() looks up the virtual UDC through vrequest->udc, but that field is never initialized when requests are allocated or queued. A gadget function that dequeues a request during disconnect can therefore dereference a NULL vudc pointer and crash the kernel.
This was observed with a USB/IP vUDC ACM gadget. ACM is not unique here; it was only the tested gadget path. The bug is in the generic vUDC dequeue path rather than in ACM itself.
Use the endpoint to recover the vudc, as the other vUDC endpoint ops already do, instead of relying on the request-private field.
--- drivers/usb/usbip/vudc_dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/usbip/vudc_dev.c +1 -1
@@ -344,7 +344,7 @@ static int vep_dequeue(struct usb_ep *_ep, struct usb_request *_req) ep =to_vep (_ep); req =to_vrequest (_req); - udc = req->udc; + udc =ep_to_vudc (ep);if (!udc->driver)return -ESHUTDOWN ;
base-commit: 186d3c4e92242351afc24d9784f31cb4cd08a4b7
Signature · 1 line
2.53.0.windows.1
Greg KH
maintainerQuoted 9 lines · Hu Xinyao
vep_dequeue()looks up the virtual UDC throughvrequest->udc, but that field is never initialized when requests are allocated or queued. A gadget function that dequeues a request during disconnect can therefore dereference a NULL vudc pointer and crash the kernel.This was observed with a USB/IP vUDC ACM gadget. ACM is not unique here; it was only the tested gadget path. The bug is in the generic vUDC dequeue path rather than in ACM itself.
Quoted 7 lines
Use the endpoint to recover the vudc, as the other vUDC endpoint ops already do, instead of relying on the request-private field.
Fixes b6a0ca111867 ("usbip: vudc: Add UDC specific ops")Reported-by Hu Xinyao <[email protected]>Signed-off-by Hu Xinyao <[email protected]>
When you author and sign off on a patch, you don't need the reported-by line.
Anyway, isn't this patch:
https://lore.kernel.org/r/[email protected]
a better one instead?
thanks,
greg k-h