From 73d3217026f69f4c6aee493ed112507e8675cb22 Mon Sep 17 00:00:00 2001 From: Pratham Pratap Date: Tue, 27 Sep 2022 14:28:12 +0530 Subject: [PATCH] usb: gadget: cdev: Requeue the request outside spinlock 'Commit I87015f00267af ("usb: gadget: cdev: Requeue the request in cser_resume if start_rx fails")' is requeuing the request in if start_rx fails as dut is in suspend mode. This needs to done outside of spinlock as usb_cser_start_rx will again acquire the port_lock to queue the request causing a deadlock condition. Fix this by requeuing the request outside the spinlock. Change-Id: Ifa1cdb338d6a7e6a2d98ced55c4dbca9caf6ba0e Signed-off-by: Pratham Pratap --- drivers/usb/gadget/function/f_cdev.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/gadget/function/f_cdev.c b/drivers/usb/gadget/function/f_cdev.c index bef28623462d..9357949a1525 100644 --- a/drivers/usb/gadget/function/f_cdev.c +++ b/drivers/usb/gadget/function/f_cdev.c @@ -573,7 +573,9 @@ static void usb_cser_resume(struct usb_function *f) if (port->setup_pending) { pr_info("%s: start_rx called due to rx_out error.\n", __func__); port->setup_pending = false; + spin_unlock_irqrestore(&port->port_lock, flags); usb_cser_start_rx(port); + spin_lock_irqsave(&port->port_lock, flags); } in = port->port_usb.in; /* process any pending requests */