Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: gadget: u_ether: Set is_suspend flag if remote wakeup fails

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>

authored by

Prashanth K and committed by
Greg Kroah-Hartman
17c2c87c c90aad36

+2 -2
+2 -2
drivers/usb/gadget/function/u_ether.c
··· 1052 1052 * There is a transfer in progress. So we trigger a remote 1053 1053 * wakeup to inform the host. 1054 1054 */ 1055 - ether_wakeup_host(dev->port_usb); 1056 - return; 1055 + if (!ether_wakeup_host(dev->port_usb)) 1056 + return; 1057 1057 } 1058 1058 spin_lock_irqsave(&dev->lock, flags); 1059 1059 link->is_suspend = true;