diff options
author | Jakub Kicinski | 2021-10-19 10:21:24 -0700 |
---|---|---|
committer | Greg Kroah-Hartman | 2021-10-20 19:31:50 +0200 |
commit | 99984b081f99ca30bbbebe5490a8328b0a212931 (patch) | |
tree | d3a1cfadb6d93df65351b1eea3c56ac821ab70c3 | |
parent | 6e4d56db30a5feb83ba233a68841ba79483e7731 (diff) |
usb: gadget: u_ether: use eth_hw_addr_set()
Commit 406f42fa0d3c ("net-next: When a bond have a massive amount
of VLANs...") introduced a rbtree for faster Ethernet address look
up. To maintain netdev->dev_addr in this tree we need to make all
the writes to it got through appropriate helpers.
Reviewed-by: Maciej Żenczykowski <maze@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Link: https://lore.kernel.org/r/20211019172124.1413620-1-kuba@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/usb/gadget/function/u_ether.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/usb/gadget/function/u_ether.c b/drivers/usb/gadget/function/u_ether.c index 85a3f6d4b5af..e0ad5aed6ac9 100644 --- a/drivers/usb/gadget/function/u_ether.c +++ b/drivers/usb/gadget/function/u_ether.c @@ -754,6 +754,7 @@ struct eth_dev *gether_setup_name(struct usb_gadget *g, struct eth_dev *dev; struct net_device *net; int status; + u8 addr[ETH_ALEN]; net = alloc_etherdev(sizeof *dev); if (!net) @@ -773,9 +774,10 @@ struct eth_dev *gether_setup_name(struct usb_gadget *g, dev->qmult = qmult; snprintf(net->name, sizeof(net->name), "%s%%d", netname); - if (get_ether_addr(dev_addr, net->dev_addr)) + if (get_ether_addr(dev_addr, addr)) dev_warn(&g->dev, "using random %s ethernet address\n", "self"); + eth_hw_addr_set(net, addr); if (get_ether_addr(host_addr, dev->host_mac)) dev_warn(&g->dev, "using random %s ethernet address\n", "host"); |