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, 17 Apr 2012 16:12:39 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	shuahkhan@...il.com
Cc:	LKML <linux-kernel@...r.kernel.org>,
	Richard Purdie <richard.purdie@...uxfoundation.org>
Subject: Re: [PATCH] leds: ledtrig-timer trigger_data allocation fix

On Tue, 17 Apr 2012 17:05:11 -0600
Shuah Khan <shuahkhan@...il.com> wrote:

> ledtrig-timer doesn't allocate memory for trigger_data and assigns
> (void *)1 to save state. Fixed it to allocate int instead. Please 
> note that non-null trigger_data is used to key off of to do proper
> cleanup in deactivation routine and not used during the life of the
> trigger itself.

In that case, overloading the value of ->trigger_data in this fashion
is inappropriate and a new field should be added to led_classdev for
this purpose.

> -	led_cdev->trigger_data = (void *)1;
> +	led_cdev->trigger_data = kzalloc(sizeof(int), GFP_KERNEL);

But that's better than what we have now.

It does require a comment though:

--- a/drivers/leds/ledtrig-timer.c~leds-ledtrig-timer-trigger_data-allocation-fix-fix
+++ a/drivers/leds/ledtrig-timer.c
@@ -89,6 +89,11 @@ static void timer_trig_activate(struct l
 	led_blink_set(led_cdev, &led_cdev->blink_delay_on,
 		      &led_cdev->blink_delay_off);
 
+	/*
+	 * Place a dummy allocation at ->trigger_data so that
+	 * timer_trig_deactivate() cleans up correctly.  This data is never
+	 * actually used.
+	 */
 	led_cdev->trigger_data = kzalloc(sizeof(int), GFP_KERNEL);
 	if (!led_cdev->trigger_data)
 		goto err_out_delayoff;
_

--
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