Thread (18 messages) flat view 18 messages, 4 authors, 2021-10-21

Re: [PATCH net-next 04/12] net: usb: don't write directly to netdev->dev_addr

From: Oliver Neukum <oneukum@suse.com>
Date: 2021-10-21 09:55:09
Also in: linux-usb

On 20.10.21 17:56, Jakub Kicinski wrote:
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.

Manually fix all net/usb drivers without separate maintainers.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
Hi,


this looks good except for catc, which needs a more complicated fix.
Do you want me to do it and drop it from this patch?

    Regards
        Oliver
quoted hunk ↗ jump to hunk
--- a/drivers/net/usb/catc.c
+++ b/drivers/net/usb/catc.c
@@ -770,6 +770,7 @@ static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id
 	struct net_device *netdev;
 	struct catc *catc;
 	u8 broadcast[ETH_ALEN];
+	u8 addr[ETH_ALEN];
 	int pktsz, ret;
 
 	if (usb_set_interface(usbdev,
@@ -870,7 +871,8 @@ static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id
 	  
 		dev_dbg(dev, "Getting MAC from SEEROM.\n");
 	  
-		catc_get_mac(catc, netdev->dev_addr);
+		catc_get_mac(catc, addr);
DMA on the stack.
quoted hunk ↗ jump to hunk
+		eth_hw_addr_set(netdev, addr);
 		
 		dev_dbg(dev, "Setting MAC into registers.\n");
 	  
@@ -899,8 +901,9 @@ static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id
 	} else {
 		dev_dbg(dev, "Performing reset\n");
 		catc_reset(catc);
-		catc_get_mac(catc, netdev->dev_addr);
-		
+		catc_get_mac(catc, addr);
DMA on the stack.
+		eth_hw_addr_set(netdev, addr);
+
 		dev_dbg(dev, "Setting RX Mode\n");
 		catc->rxmode[0] = RxEnable | RxPolarity | RxMultiCast;
 		catc->rxmode[1] = 0;
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help