[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250818075722.2575543-1-xu.yang_2@nxp.com>
Date: Mon, 18 Aug 2025 15:57:22 +0800
From: Xu Yang <xu.yang_2@....com>
To: oneukum@...e.com,
andrew+netdev@...n.ch,
davem@...emloft.net,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
linux-usb@...r.kernel.org
Cc: netdev@...r.kernel.org
Subject: [PATCH] net: usbnet: skip info->stop() callback if suspend_count is not 0
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/
Signed-off-by: Xu Yang <xu.yang_2@....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
Powered by blists - more mailing lists