Thread (6 messages) 6 messages, 2 authors, 2025-09-05
STALE296d

[PATCH] net: usbnet: skip info->stop() callback if suspend_count is not 0

From: Xu Yang <xu.yang_2@nxp.com>
Date: 2025-08-18 07:57:49
Also in: linux-usb
Subsystem: networking drivers, the rest, usb "usbnet" driver framework, usb networking drivers · Maintainers: Andrew Lunn, "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds, Oliver Neukum

Once suspend_count is greater than 0, it means the USB device is
already suspended. Before calling usbnet_stop(), normally the USB
device should be in working state or already be resumed. If not,
the USB device may be already disconnected. In this case, we should
skip info->stop() callback to avoid abnormal behaviors.

Closes: https://lore.kernel.org/netdev/20250806083017.3289300-1-xu.yang_2@nxp.com/ (local)
Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
---
 drivers/net/usb/usbnet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 511c4154cf74..27642b76a3eb 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -839,7 +839,7 @@ int usbnet_stop (struct net_device *net)
 	pm = usb_autopm_get_interface(dev->intf);
 	/* allow minidriver to stop correctly (wireless devices to turn off
 	 * radio etc) */
-	if (info->stop) {
+	if (info->stop && !dev->suspend_count) {
 		retval = info->stop(dev);
 		if (retval < 0)
 			netif_info(dev, ifdown, dev->net,
-- 
2.34.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help