Skip to contentSkip to conversation

net: usb: rtl8150: handle link status read failures

PATCH Superseded Yousef Alhouseen 2 participants 2 messages Jun 28

Subsystems (5)

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 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.

---
 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
#1 lore raw
Quoted 9 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.

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

Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")

If it is for net-next it does not need a Fixes tag.

Please also note that:

https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html

say:

* don’t repost your patches within one 24h period

It is a good idea the read that whole document.

Andrew