]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
usb: gadget: u_ether: Set is_suspend flag if remote wakeup fails
authorPrashanth K <prashanth.k@oss.qualcomm.com>
Wed, 12 Feb 2025 10:08:40 +0000 (15:38 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 19 Feb 2025 14:18:41 +0000 (15:18 +0100)
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>
drivers/usb/gadget/function/u_ether.c

index 09e2838917e29401af6aeb8635b1a32c7dd9cf2a..f58590bf5e02f5f785cf5bdc287f5ce9c95e47c3 100644 (file)
@@ -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;