netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usbnet: use each random address only once
@ 2022-06-29 14:21 Oliver Neukum
  2022-06-30  3:50 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Oliver Neukum @ 2022-06-29 14:21 UTC (permalink / raw)
  To: davem, kuba, netdev, linux-usb; +Cc: Oliver Neukum

Even random MACs should be unique to a device.
Get a new one each time it is used.

This bug is as old as the driver.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
---
 drivers/net/usb/usbnet.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 02b915b1e142..a90aece93f4a 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -1797,8 +1797,11 @@ usbnet_probe (struct usb_interface *udev, const struct usb_device_id *prod)
 	}
 
 	/* let userspace know we have a random address */
-	if (ether_addr_equal(net->dev_addr, node_id))
+	if (ether_addr_equal(net->dev_addr, node_id)) {
 		net->addr_assign_type = NET_ADDR_RANDOM;
+		/* next device needs a new one*/
+		eth_random_addr(node_id);
+	}
 
 	if ((dev->driver_info->flags & FLAG_WLAN) != 0)
 		SET_NETDEV_DEVTYPE(net, &wlan_type);
-- 
2.35.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-30  3:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-29 14:21 [PATCH] usbnet: use each random address only once Oliver Neukum
2022-06-30  3:50 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).