Skip to content

Commit

Permalink
leds: trigger: netdev: Recheck NETDEV_LED_MODE_LINKUP on dev rename
Browse files Browse the repository at this point in the history
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: 5f820ed ("leds: trigger: netdev: fix handling on interface rename")
Cc: stable@vger.kernel.org # v5.5+
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Lee Jones <lee@kernel.org>
Link: https://lore.kernel.org/r/20230419210743.3594-2-ansuelsmth@gmail.com
  • Loading branch information
Ansuel authored and lag-linaro committed May 25, 2023
1 parent ac9a786 commit cee4bd1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/leds/trigger/ledtrig-netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit cee4bd1

Please sign in to comment.