From: Andrew Lunn <andrew@lunn.ch>
To: David Yang <mmyangfl@gmail.com>
Cc: Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org, Vladimir Oltean <olteanv@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v11 4/5] net: dsa: motorcomm: Add LED support
Date: Wed, 2 Sep 2026 14:04:33 +0200 [thread overview]
Message-ID: <f17be0c1-96a4-4226-9581-a28a07d14a73@lunn.ch> (raw)
In-Reply-To: <CAAXyoMOQf8oK3Z_TQKDmLvCQmgAjUR29VnFSFi+np4RtNNw_bg@mail.gmail.com>
> > 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?
> >
> > > @@ -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
next prev parent reply other threads:[~2026-09-02 12:04 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 4:38 [PATCH net-next v11 0/5] net: dsa: motorcomm: Add LED support David Yang
2026-08-31 4:38 ` [PATCH net-next v11 1/5] net: dsa: yt921x: Check lock status with lockdep_assert_held_once() David Yang
2026-08-31 23:29 ` Andrew Lunn
2026-09-02 0:56 ` Jakub Kicinski
2026-08-31 4:38 ` [PATCH net-next v11 2/5] net: dsa: motorcomm: Move to subdirectory David Yang
2026-08-31 4:38 ` [PATCH net-next v11 3/5] net: dsa: motorcomm: Split SMI module David Yang
2026-08-31 4:38 ` [PATCH net-next v11 4/5] net: dsa: motorcomm: Add LED support David Yang
2026-09-01 4:49 ` sashiko-bot
2026-09-02 0:56 ` Jakub Kicinski
2026-09-02 3:04 ` David Yang
2026-09-02 12:04 ` Andrew Lunn [this message]
2026-08-31 4:38 ` [PATCH net-next v11 5/5] dt-bindings: net: dsa: yt921x: Add LEDs definition example David Yang
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=f17be0c1-96a4-4226-9581-a28a07d14a73@lunn.ch \
--to=andrew@lunn.ch \
--cc=conor+dt@kernel.org \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=edumazet@google.com \
--cc=krzk+dt@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mmyangfl@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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