Skip to content

Commit 8a7d12d

Browse files
oneukumPaolo Abeni
authored andcommitted
net: usb: usbnet: fix name regression
The fix for MAC addresses broke detection of the naming convention because it gave network devices no random MAC before bind() was called. This means that the check for the local assignment bit was always negative as the address was zeroed from allocation, instead of from overwriting the MAC with a unique hardware address. The correct check for whether bind() has altered the MAC is done with is_zero_ether_addr Signed-off-by: Oliver Neukum <[email protected]> Reported-by: Greg Thelen <[email protected]> Diagnosed-by: John Sperbeck <[email protected]> Fixes: bab8eb0 ("usbnet: modern method to get random MAC") Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent f7b4cf0 commit 8a7d12d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/net/usb/usbnet.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1767,7 +1767,8 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
17671767
// can rename the link if it knows better.
17681768
if ((dev->driver_info->flags & FLAG_ETHER) != 0 &&
17691769
((dev->driver_info->flags & FLAG_POINTTOPOINT) == 0 ||
1770-
(net->dev_addr [0] & 0x02) == 0))
1770+
/* somebody touched it*/
1771+
!is_zero_ether_addr(net->dev_addr)))
17711772
strscpy(net->name, "eth%d", sizeof(net->name));
17721773
/* WLAN devices should always be named "wlan%d" */
17731774
if ((dev->driver_info->flags & FLAG_WLAN) != 0)

0 commit comments

Comments
 (0)