summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPrashanth K <prashanth.k@oss.qualcomm.com>2025-02-12 13:08:40 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-03-13 15:08:01 +0300
commit268bb3e8f1a67d43ac268ba3b89ed1f7b050b0e6 (patch)
tree1e8b2d5e2e7eb442ce8f0b6000edbd246f14d156
parent94dcb378cabed0bcbd60dc22b71740839073f2fd (diff)
downloadlinux-268bb3e8f1a67d43ac268ba3b89ed1f7b050b0e6.tar.xz
usb: gadget: u_ether: Set is_suspend flag if remote wakeup fails
commit 17c2c87c37862c3e95b55f660681cc6e8d66660e upstream. Currently while UDC suspends, u_ether attempts to remote wakeup the host if there are any pending transfers. However, if remote wakeup fails, the UDC remains suspended but the is_suspend flag is not set. And since is_suspend flag isn't set, the subsequent eth_start_xmit() would queue USB requests to suspended UDC. To fix this, bail out from gether_suspend() only if remote wakeup operation is successful. Cc: stable <stable@kernel.org> Fixes: 0a1af6dfa077 ("usb: gadget: f_ecm: Add suspend/resume and remote wakeup support") Signed-off-by: Prashanth K <prashanth.k@oss.qualcomm.com> Link: https://lore.kernel.org/r/20250212100840.3812153-1-prashanth.k@oss.qualcomm.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/gadget/function/u_ether.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c
index 09e2838917e2..f58590bf5e02 100644
--- a/drivers/usb/gadget/function/u_ether.c
+++ b/drivers/usb/gadget/function/u_ether.c
@@ -1052,8 +1052,8 @@ void gether_suspend(struct gether *link)
* There is a transfer in progress. So we trigger a remote
* wakeup to inform the host.
*/
- ether_wakeup_host(dev->port_usb);
- return;
+ if (!ether_wakeup_host(dev->port_usb))
+ return;
}
spin_lock_irqsave(&dev->lock, flags);
link->is_suspend = true;