lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <92eff1db-004c-4c08-9dd3-ae094d8dd316@gmail.com>
Date: Sat, 13 Jan 2024 15:31:58 +0100
From: Heiner Kallweit <hkallweit1@...il.com>
To: Luiz Angelo Daros de Luca <luizluca@...il.com>,
 Christian Marangi <ansuelsmth@...il.com>
Cc: linus.walleij@...aro.org, alsi@...g-olufsen.dk, andrew@...n.ch,
 f.fainelli@...il.com, olteanv@...il.com, davem@...emloft.net,
 edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
 arinc.unal@...nc9.com, netdev@...r.kernel.org
Subject: Re: [RFC net-next 0/2] net: dsa: realtek: fix LED support for
 rtl8366rb

On 13.01.2024 15:24, Luiz Angelo Daros de Luca wrote:
>> I'll try to get who scheduled the work and the stack from there. It
>> might already pinpoint the cause. Checking if the work is pending
>> during netdev trigger activation might also help. I'll also try to
>> flush (or cancel) the work before activating the new trigger. I just
>> don't know if I can flush (and that way, blocking) inside
>> led_set_brightness().
>>
> 
> Hi Christian,
> 
> I got it. It was actually from the netdev trigger. During activation we have:
> 
>         /* Check if hw control is active by default on the LED.
>          * Init already enabled mode in hw control.
>          */
>         if (supports_hw_control(led_cdev)) {
>                 dev = led_cdev->hw_control_get_device(led_cdev);
>                 if (dev) {
>                         const char *name = dev_name(dev);
> 
>                         set_device_name(trigger_data, name, strlen(name));
>                         trigger_data->hw_control = true;
> 
>                         rc = led_cdev->hw_control_get(led_cdev, &mode);
>                         if (!rc)
>                                 trigger_data->mode = mode;
>                 }
>         }
> 
> The set_device_name calls set_baseline_state() that, at this point,
> will start to monitor the device using sw control
> (trigger_data->hw_control is only set afterwards). In
> set_baseline_state(), it will call led_set_brightness in most
> codepaths (all of them if trigger_data->hw_control is false). With
> link down (and other situations), it will call
> led_set_brightness(led_cdev, LED_OFF). If that led_set_brightness
> takes some time to be processed, it will happen after the hw control
> was configured, undoing what it previously just did.
> 
> Is there any good reason to call set_device_name before the led mode
> and hw_control are defined? Will this break anything?
> 
> diff --git a/drivers/leds/trigger/ledtrig-netdev.c
> b/drivers/leds/trigger/ledtrig-netdev.c
> index d76214fa9ad8..6f72d55c187a 100644
> --- a/drivers/leds/trigger/ledtrig-netdev.c
> +++ b/drivers/leds/trigger/ledtrig-netdev.c
> @@ -572,12 +572,13 @@ static int netdev_trig_activate(struct
> led_classdev *led_cdev)
>                if (dev) {
>                        const char *name = dev_name(dev);
> 
> -                       set_device_name(trigger_data, name, strlen(name));
>                        trigger_data->hw_control = true;
> 
>                        rc = led_cdev->hw_control_get(led_cdev, &mode);
>                        if (!rc)
>                                trigger_data->mode = mode;
> +
> +                       set_device_name(trigger_data, name, strlen(name));
>                }
>        }
> 
> With this patch, it will not undo the trigger setting in hardware
> anymore. However, it now calls the hw_control_set 3 times during
> activation:
> 
This is addressed by the following patch, it should show up in linux-next
after the merge window.

https://git.kernel.org/pub/scm/linux/kernel/git/lee/leds.git/commit/?h=for-leds-next-next&id=5df2b4ed10a4ea636bb5ace99712a7d0c6226a55

> 1) set_device_name
> 2) register_netdevice_notifier on NETDEV_REGISTER
> 3) register_netdevice_notifier on NETDEV_UP
> 
> Anyway, calling it multiple times doesn't break anything.
> 
> Regards,
> 
> Luiz
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ