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:	Tue,  5 Jun 2012 23:38:59 +0200
From:	Fabio Baltieri <fabio.baltieri@...il.com>
To:	Bryan Wu <bryan.wu@...onical.com>
Cc:	linux-leds@...r.kernel.org, linux-kernel@...r.kernel.org,
	Richard Purdie <rpurdie@...ys.net>,
	Fabio Baltieri <fabio.baltieri@...il.com>
Subject: [PATCH 2/2] leds: fix led_brightness_set when soft-blinking

Change led_brightness_set to ensure software blink timer is stopped
before calling led_stop_software_blink() and use led_set_brightness()
instead of calling led_cdev->brightness_set() directly to ensure
led_cdev->brightness is always consistent with current LED status.

This ensure proper cleaning when changing triggers, as without this fix
a LED may be turned off while leaving it's led_cdev->brightness = 1,
leading to an erratic software-blink behaviour.

The problem was easy to reproduce by changing the trigger from "timer"
to "oneshot".

Signed-off-by: Fabio Baltieri <fabio.baltieri@...il.com>
Cc: Bryan Wu <bryan.wu@...onical.com>
---
 drivers/leds/led-core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c
index 579eb78..3e9f934 100644
--- a/drivers/leds/led-core.c
+++ b/drivers/leds/led-core.c
@@ -115,7 +115,8 @@ EXPORT_SYMBOL(led_blink_set_oneshot);
 void led_brightness_set(struct led_classdev *led_cdev,
 			enum led_brightness brightness)
 {
+	del_timer_sync(&led_cdev->blink_timer);
 	led_stop_software_blink(led_cdev);
-	led_cdev->brightness_set(led_cdev, brightness);
+	led_set_brightness(led_cdev, brightness);
 }
 EXPORT_SYMBOL(led_brightness_set);
-- 
1.7.10.2.520.g6a4a482.dirty

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ