Thread (12 messages) flat view 12 messages, 4 authors, 1d ago

Re: [PATCH net-next v11 4/5] net: dsa: motorcomm: Add LED support

From: Andrew Lunn <andrew@lunn.ch>
Date: 2026-09-02 12:04:46
Also in: linux-devicetree, lkml

quoted
Would an "echo netdev > /sys/class/leds/<led>/trigger" racing with switch
unbind, or with the dsa_tree_setup() error path, touch a freed
net_device here? Would removing the LEDs per port before the netdevs go
away, or validating dp->user under rtnl_lock, avoid that?
quoted
@@ -4581,6 +4589,12 @@ static int yt921x_dsa_setup(struct dsa_switch *ds)
      if (res)
              return res;

+#if IS_ENABLED(CONFIG_NET_DSA_YT921X_LEDS)
+     res = yt921x_leds_setup(priv);
+     if (res)
+             dev_warn(dev, "Failed to setup LEDs: %d\n", res);
+#endif
+
Just a question: I don't see any protection against this in other DSA
led drivers, like mv88e6 or qca8k.
Registering the LEDs uses devm_ so the life of the LEDs is the life of
the chip. The LED trigger does however take a reference on the network
device, so it should not be possible for it to disappear while the
trigger is still bound to it.

	Andrew
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help