Skip to contentSkip to conversation

net: usb: rtl8150: handle link status read failures

PATCH Applied Yousef Alhouseen 3 participants 3 messages Jun 30 – Jul 2

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 net: usb: rtl8150: handle link status read failures

set_carrier() ignores the result of the USB control transfer and tests the stack variable supplied as its receive buffer. If the device rejects or aborts the request, that variable remains uninitialized and the driver chooses an arbitrary carrier state.

Leave the existing carrier state unchanged when the link status cannot be read. A transient USB error should not be treated as link loss.

---
Changes in v4:
- Target net-next and drop the Fixes tag as requested.
- Rebase onto current net-next after the 24-hour repost interval.

 drivers/net/usb/rtl8150.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/usb/rtl8150.c +3 -1
index c880c95c41a5..d51e43170e03 100644
@@ -732,7 +732,9 @@ static void set_carrier(struct net_device *netdev)
 	rtl8150_t *dev = netdev_priv(netdev);
 	short tmp;
 
-	get_registers(dev, CSCR, 2, &tmp);
+	if (get_registers(dev, CSCR, 2, &tmp))
+		return;
+
 	if (tmp & CSCR_LINK_STATUS)
 		netif_carrier_on(netdev);
 	else
Signature · 1 line
2.54.0
Reviewed-by on v4 1/1
#1 lore raw
Quoted 5 lines · Yousef Alhouseen

set_carrier() ignores the result of the USB control transfer and tests the stack variable supplied as its receive buffer. If the device rejects or aborts the request, that variable remains uninitialized and the driver chooses an arbitrary carrier state.

Quoted 7 lines

Leave the existing carrier state unchanged when the link status cannot be read. A transient USB error should not be treated as link loss.

Andrew

#2 lore raw
In reply to Yousef Alhouseen
This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Quoted 9 lines · On Tue, 30 Jun 2026 12:12:16 +0200 you wrote:

set_carrier() ignores the result of the USB control transfer and tests the stack variable supplied as its receive buffer. If the device rejects or aborts the request, that variable remains uninitialized and the driver chooses an arbitrary carrier state.

Leave the existing carrier state unchanged when the link status cannot be read. A transient USB error should not be treated as link loss.

[...]

Here is the summary with links:
- [net-next,v4] net: usb: rtl8150: handle link status read failures

    https://git.kernel.org/netdev/net-next/c/8c9c5b9a6896

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html