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]
Date: Thu, 18 May 2023 13:13:11 +0100
From: Lee Jones <lee@...nel.org>
To: Hans de Goede <hdegoede@...hat.com>
Cc: Pavel Machek <pavel@....cz>,
	Jacek Anaszewski <jacek.anaszewski@...il.com>,
	Sebastian Reichel <sre@...nel.org>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Michael Grzeschik <m.grzeschik@...gutronix.de>,
	Johannes Berg <johannes@...solutions.net>,
	Pablo Neira Ayuso <pablo@...filter.org>,
	Jozsef Kadlecsik <kadlec@...filter.org>, linux-leds@...r.kernel.org,
	linux-pm@...r.kernel.org, linux-usb@...r.kernel.org,
	netdev@...r.kernel.org, netfilter-devel@...r.kernel.org,
	coreteam@...filter.org, Yauhen Kharuzhy <jekhor@...il.com>
Subject: Re: [PATCH RESEND 2/4] leds: Fix set_brightness_delayed() race

On Wed, 10 May 2023, Hans de Goede wrote:

> When a trigger wants to switch from blinking to LED on it needs to call:
> 	led_set_brightness(LED_OFF);
> 	led_set_brightness(LED_FULL);
> 
> To first call disables blinking and the second then turns the LED on
> (the power-supply charging-blink-full-solid triggers do this).
> 
> These calls happen immediately after each other, so it is possible
> that set_brightness_delayed() from the first call has not run yet
> when the led_set_brightness(LED_FULL) call finishes.
> 
> If this race hits then this is causing problems for both
> sw- and hw-blinking:
> 
> For sw-blinking set_brightness_delayed() clears delayed_set_value
> when LED_BLINK_DISABLE is set causing the led_set_brightness(LED_FULL)
> call effects to get lost when hitting the race, resulting in the LED
> turning off instead of on.
> 
> For hw-blinking if the race hits delayed_set_value has been
> set to LED_FULL by the time set_brightness_delayed() runs.
> So led_cdev->brightness_set_blocking() is never called with
> LED_OFF as argument and the hw-blinking is never disabled leaving
> the LED blinking instead of on.
> 
> Fix both issues by adding LED_SET_BRIGHTNESS and LED_SET_BRIGHTNESS_OFF
> work_flags making this 2 separate actions to be run by
> set_brightness_delayed().
> 
> Reviewed-by: Jacek Anaszewski <jacek.anaszewski@...il.com>
> Tested-by: Yauhen Kharuzhy <jekhor@...il.com>
> Signed-off-by: Hans de Goede <hdegoede@...hat.com>
> ---
>  drivers/leds/led-core.c | 57 +++++++++++++++++++++++++++++++----------
>  include/linux/leds.h    |  3 +++
>  2 files changed, 47 insertions(+), 13 deletions(-)

Applied, thanks

-- 
Lee Jones [李琼斯]

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ