usb: gadget: f_printer: use the active RX list in soft reset
Subsystems (2)
PATCH 1/1 usb: gadget: f_printer: use the active RX list in soft reset
printer_soft_reset() tests rx_reqs_active in its second draining loop but retrieves the next entry from rx_buffers. If rx_reqs_active is non-empty after endpoint shutdown, this operates on the wrong list and never removes the active entry, leading to list corruption and a non-terminating loop.
Retrieve the request from the list named by the loop condition.
Fixes 25a010c8c1a5 ("USB: add Printer Gadget Driver")
Signed-off-by Aldo Ariel Panzardo <[email protected]>
--- drivers/usb/gadget/function/f_printer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/gadget/function/f_printer.c +2 -2
@@ -940,8 +940,8 @@ static void printer_soft_reset(struct printer_dev *dev) }while (likely (!(list_empty (&dev->rx_reqs_active)))) { - req = container_of(dev->rx_buffers.next, struct usb_request, - list); + req =list_first_entry (&dev->rx_reqs_active, + struct usb_request, list);list_del_init (&req->list);list_add (&req->list, &dev->rx_reqs); }
Signature · 1 line
2.43.0