Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH 1/5] leds: trigger: netdev: recheck NETDEV_LED_MODE_LINKUP on dev rename
       [not found] <20230419210743.3594-1-ansuelsmth@gmail.com>
@ 2023-04-19 21:07 ` Christian Marangi
  2023-04-20  0:21   ` Andrew Lunn
  2023-04-24 13:42   ` Lee Jones
  0 siblings, 2 replies; 3+ messages in thread
From: Christian Marangi @ 2023-04-19 21:07 UTC (permalink / raw)
  To: Pavel Machek, Lee Jones, Christian Marangi, Martin Schiller,
	linux-leds, linux-kernel, Andrew Lunn
  Cc: stable

Dev can be renamed also while up for supported device. We currently
wrongly clear the NETDEV_LED_MODE_LINKUP flag on NETDEV_CHANGENAME
event.

Fix this by rechecking if the carrier is ok on NETDEV_CHANGENAME and
correctly set the NETDEV_LED_MODE_LINKUP bit.

Fixes: 5f820ed52371 ("leds: trigger: netdev: fix handling on interface rename")
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Cc: stable@vger.kernel.org # v5.5+
---
 drivers/leds/trigger/ledtrig-netdev.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/leds/trigger/ledtrig-netdev.c b/drivers/leds/trigger/ledtrig-netdev.c
index d5e774d83021..f4d670ec30bc 100644
--- a/drivers/leds/trigger/ledtrig-netdev.c
+++ b/drivers/leds/trigger/ledtrig-netdev.c
@@ -318,6 +318,9 @@ static int netdev_trig_notify(struct notifier_block *nb,
 	clear_bit(NETDEV_LED_MODE_LINKUP, &trigger_data->mode);
 	switch (evt) {
 	case NETDEV_CHANGENAME:
+		if (netif_carrier_ok(dev))
+			set_bit(NETDEV_LED_MODE_LINKUP, &trigger_data->mode);
+		fallthrough;
 	case NETDEV_REGISTER:
 		if (trigger_data->net_dev)
 			dev_put(trigger_data->net_dev);
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/5] leds: trigger: netdev: recheck NETDEV_LED_MODE_LINKUP on dev rename
  2023-04-19 21:07 ` [PATCH 1/5] leds: trigger: netdev: recheck NETDEV_LED_MODE_LINKUP on dev rename Christian Marangi
@ 2023-04-20  0:21   ` Andrew Lunn
  2023-04-24 13:42   ` Lee Jones
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2023-04-20  0:21 UTC (permalink / raw)
  To: Christian Marangi
  Cc: Pavel Machek, Lee Jones, Martin Schiller, linux-leds,
	linux-kernel, stable

On Wed, Apr 19, 2023 at 11:07:39PM +0200, Christian Marangi wrote:
> Dev can be renamed also while up for supported device. We currently
> wrongly clear the NETDEV_LED_MODE_LINKUP flag on NETDEV_CHANGENAME
> event.
> 
> Fix this by rechecking if the carrier is ok on NETDEV_CHANGENAME and
> correctly set the NETDEV_LED_MODE_LINKUP bit.
> 
> Fixes: 5f820ed52371 ("leds: trigger: netdev: fix handling on interface rename")
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> Cc: stable@vger.kernel.org # v5.5+

Since this is a fix, it should be posted on its own. It should then
get merged faster and backported to stable.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/5] leds: trigger: netdev: recheck NETDEV_LED_MODE_LINKUP on dev rename
  2023-04-19 21:07 ` [PATCH 1/5] leds: trigger: netdev: recheck NETDEV_LED_MODE_LINKUP on dev rename Christian Marangi
  2023-04-20  0:21   ` Andrew Lunn
@ 2023-04-24 13:42   ` Lee Jones
  1 sibling, 0 replies; 3+ messages in thread
From: Lee Jones @ 2023-04-24 13:42 UTC (permalink / raw)
  To: Christian Marangi
  Cc: Pavel Machek, Martin Schiller, linux-leds, linux-kernel,
	Andrew Lunn, stable

On Wed, 19 Apr 2023, Christian Marangi wrote:

> Dev can be renamed also while up for supported device. We currently
> wrongly clear the NETDEV_LED_MODE_LINKUP flag on NETDEV_CHANGENAME
> event.
> 
> Fix this by rechecking if the carrier is ok on NETDEV_CHANGENAME and
> correctly set the NETDEV_LED_MODE_LINKUP bit.
> 
> Fixes: 5f820ed52371 ("leds: trigger: netdev: fix handling on interface rename")
> Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
> Cc: stable@vger.kernel.org # v5.5+
> ---
>  drivers/leds/trigger/ledtrig-netdev.c | 3 +++
>  1 file changed, 3 insertions(+)

Applied, thanks

-- 
Lee Jones [李琼斯]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-04-24 13:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20230419210743.3594-1-ansuelsmth@gmail.com>
2023-04-19 21:07 ` [PATCH 1/5] leds: trigger: netdev: recheck NETDEV_LED_MODE_LINKUP on dev rename Christian Marangi
2023-04-20  0:21   ` Andrew Lunn
2023-04-24 13:42   ` Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox