From 71c5482419c82b93e46b38b88768dd593cae0eba Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sun, 24 Aug 2025 10:49:28 +0200 Subject: [PATCH] 5.10-stable patches added patches: net-usbnet-fix-the-wrong-netif_carrier_on-call.patch --- ...-fix-the-wrong-netif_carrier_on-call.patch | 57 +++++++++++++++++++ queue-5.10/series | 1 + 2 files changed, 58 insertions(+) create mode 100644 queue-5.10/net-usbnet-fix-the-wrong-netif_carrier_on-call.patch diff --git a/queue-5.10/net-usbnet-fix-the-wrong-netif_carrier_on-call.patch b/queue-5.10/net-usbnet-fix-the-wrong-netif_carrier_on-call.patch new file mode 100644 index 0000000000..fdb98b42f9 --- /dev/null +++ b/queue-5.10/net-usbnet-fix-the-wrong-netif_carrier_on-call.patch @@ -0,0 +1,57 @@ +From 8466d393700f9ccef68134d3349f4e0a087679b9 Mon Sep 17 00:00:00 2001 +From: Ammar Faizi +Date: Wed, 6 Aug 2025 07:31:05 +0700 +Subject: net: usbnet: Fix the wrong netif_carrier_on() call + +From: Ammar Faizi + +commit 8466d393700f9ccef68134d3349f4e0a087679b9 upstream. + +The commit referenced in the Fixes tag causes usbnet to malfunction +(identified via git bisect). Post-commit, my external RJ45 LAN cable +fails to connect. Linus also reported the same issue after pulling that +commit. + +The code has a logic error: netif_carrier_on() is only called when the +link is already on. Fix this by moving the netif_carrier_on() call +outside the if-statement entirely. This ensures it is always called +when EVENT_LINK_CARRIER_ON is set and properly clears it regardless +of the link state. + +Cc: stable@vger.kernel.org +Cc: Armando Budianto +Reviewed-by: Simon Horman +Suggested-by: Linus Torvalds +Link: https://lore.kernel.org/all/CAHk-=wjqL4uF0MG_c8+xHX1Vv8==sPYQrtzbdA3kzi96284nuQ@mail.gmail.com +Closes: https://lore.kernel.org/netdev/CAHk-=wjKh8X4PT_mU1kD4GQrbjivMfPn-_hXa6han_BTDcXddw@mail.gmail.com +Closes: https://lore.kernel.org/netdev/0752dee6-43d6-4e1f-81d2-4248142cccd2@gnuweeb.org +Fixes: 0d9cfc9b8cb1 ("net: usbnet: Avoid potential RCU stall on LINK_CHANGE event") +Signed-off-by: Ammar Faizi +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman +--- + drivers/net/usb/usbnet.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/net/usb/usbnet.c ++++ b/drivers/net/usb/usbnet.c +@@ -1071,6 +1071,9 @@ static void __handle_link_change(struct + if (!test_bit(EVENT_DEV_OPEN, &dev->flags)) + return; + ++ if (test_and_clear_bit(EVENT_LINK_CARRIER_ON, &dev->flags)) ++ netif_carrier_on(dev->net); ++ + if (!netif_carrier_ok(dev->net)) { + /* kill URBs for reading packets to save bus bandwidth */ + unlink_urbs(dev, &dev->rxq); +@@ -1080,9 +1083,6 @@ static void __handle_link_change(struct + * tx queue is stopped by netcore after link becomes off + */ + } else { +- if (test_and_clear_bit(EVENT_LINK_CARRIER_ON, &dev->flags)) +- netif_carrier_on(dev->net); +- + /* submitting URBs for reading packets */ + tasklet_schedule(&dev->bh); + } diff --git a/queue-5.10/series b/queue-5.10/series index 0108193c9b..98bd41319f 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -498,3 +498,4 @@ usb-dwc3-remove-dwc3-locking-during-gadget-suspend-resume.patch usb-dwc3-core-remove-lock-of-otg-mode-during-gadget-suspend-resume-to-avoid-deadlock.patch gpio-rcar-use-raw_spinlock-to-protect-register-access.patch selftests-mptcp-pm-check-flush-doesn-t-reset-limits.patch +net-usbnet-fix-the-wrong-netif_carrier_on-call.patch -- 2.47.3