From: Oliver Neukum <oneukum@suse•com>
To: davem@davemloft•net, kuba@kernel•org, netdev@vger•kernel.org,
linux-usb@vger•kernel.org
Cc: Oliver Neukum <oneukum@suse•com>
Subject: [PATCH] usbnet: use each random address only once
Date: Wed, 29 Jun 2022 16:21:49 +0200 [thread overview]
Message-ID: <20220629142149.1298-1-oneukum@suse.com> (raw)
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
next reply other threads:[~2022-06-29 14:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-29 14:21 Oliver Neukum [this message]
2022-06-30 3:50 ` [PATCH] usbnet: use each random address only once Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220629142149.1298-1-oneukum@suse.com \
--to=oneukum@suse$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=kuba@kernel$(echo .)org \
--cc=linux-usb@vger$(echo .)kernel.org \
--cc=netdev@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox