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>] [day] [month] [year] [list]
Message-ID: <20060829205432.GA13522@hansmi.ch>
Date:	Tue, 29 Aug 2006 22:54:32 +0200
From:	Michael Hanselmann <linux-kernel@...smi.ch>
To:	Richard Purdie <rpurdie@...ys.net>
Cc:	Dmitry Torokhov <dmitry.torokhov@...il.com>,
	LKML <linux-kernel@...r.kernel.org>,
	"Antonino A. Daplas" <adaplas@....net>
Subject: Re: [patch 5/6] Convert to use mutexes instead of semaphores

On Fri, Aug 11, 2006 at 05:45:51PM +0100, Richard Purdie wrote:
> On Fri, 2006-08-11 at 10:07 -0400, Dmitry Torokhov wrote: 
> > On 8/11/06, Michael Hanselmann <linux-kernel@...smi.ch> wrote:
> > > Because I am responsible/wrote for the broken code, how should I
> > > proceed?

Somehow this got lost, sorry. The patch below fixes at least the
wrongly ordered up()/down() calls. I know there are outstanding with the
backlight code in general, but those issues aren't that easy to fix.

Is it okay? If yes, I'm going to send it to akpm.

Signed-off-by: Michael Hanselmann <linux-kernel@...smi.ch>

---
diff -Nrup --exclude-from linux-exclude-from linux-2.6.18-rc5.orig/drivers/macintosh/via-pmu-backlight.c linux-2.6.18-rc5/drivers/macintosh/via-pmu-backlight.c
--- linux-2.6.18-rc5.orig/drivers/macintosh/via-pmu-backlight.c	2006-08-29 22:27:01.000000000 +0200
+++ linux-2.6.18-rc5/drivers/macintosh/via-pmu-backlight.c	2006-08-29 22:40:58.000000000 +0200
@@ -168,11 +168,11 @@ void __init pmu_backlight_init()
 		mutex_unlock(&info->bl_mutex);
 	}
 
-	up(&bd->sem);
+	down(&bd->sem);
 	bd->props->brightness = level;
 	bd->props->power = FB_BLANK_UNBLANK;
 	bd->props->update_status(bd);
-	down(&bd->sem);
+	up(&bd->sem);
 
 	mutex_lock(&pmac_backlight_mutex);
 	if (!pmac_backlight)
diff -Nrup --exclude-from linux-exclude-from linux-2.6.18-rc5.orig/drivers/video/aty/aty128fb.c linux-2.6.18-rc5/drivers/video/aty/aty128fb.c
--- linux-2.6.18-rc5.orig/drivers/video/aty/aty128fb.c	2006-08-29 22:27:01.000000000 +0200
+++ linux-2.6.18-rc5/drivers/video/aty/aty128fb.c	2006-08-29 22:41:24.000000000 +0200
@@ -1801,10 +1801,10 @@ static struct backlight_properties aty12
 static void aty128_bl_set_power(struct fb_info *info, int power)
 {
 	mutex_lock(&info->bl_mutex);
-	up(&info->bl_dev->sem);
+	down(&info->bl_dev->sem);
 	info->bl_dev->props->power = power;
 	__aty128_bl_update_status(info->bl_dev);
-	down(&info->bl_dev->sem);
+	up(&info->bl_dev->sem);
 	mutex_unlock(&info->bl_mutex);
 }
 
@@ -1839,11 +1839,11 @@ static void aty128_bl_init(struct aty128
 		219 * FB_BACKLIGHT_MAX / MAX_LEVEL);
 	mutex_unlock(&info->bl_mutex);
 
-	up(&bd->sem);
+	down(&bd->sem);
 	bd->props->brightness = aty128_bl_data.max_brightness;
 	bd->props->power = FB_BLANK_UNBLANK;
 	bd->props->update_status(bd);
-	down(&bd->sem);
+	up(&bd->sem);
 
 #ifdef CONFIG_PMAC_BACKLIGHT
 	mutex_lock(&pmac_backlight_mutex);
diff -Nrup --exclude-from linux-exclude-from linux-2.6.18-rc5.orig/drivers/video/aty/atyfb_base.c linux-2.6.18-rc5/drivers/video/aty/atyfb_base.c
--- linux-2.6.18-rc5.orig/drivers/video/aty/atyfb_base.c	2006-08-29 22:27:01.000000000 +0200
+++ linux-2.6.18-rc5/drivers/video/aty/atyfb_base.c	2006-08-29 22:41:47.000000000 +0200
@@ -2200,10 +2200,10 @@ static struct backlight_properties aty_b
 static void aty_bl_set_power(struct fb_info *info, int power)
 {
 	mutex_lock(&info->bl_mutex);
-	up(&info->bl_dev->sem);
+	down(&info->bl_dev->sem);
 	info->bl_dev->props->power = power;
 	__aty_bl_update_status(info->bl_dev);
-	down(&info->bl_dev->sem);
+	up(&info->bl_dev->sem);
 	mutex_unlock(&info->bl_mutex);
 }
 
@@ -2234,11 +2234,11 @@ static void aty_bl_init(struct atyfb_par
 		0xFF * FB_BACKLIGHT_MAX / MAX_LEVEL);
 	mutex_unlock(&info->bl_mutex);
 
-	up(&bd->sem);
+	down(&bd->sem);
 	bd->props->brightness = aty_bl_data.max_brightness;
 	bd->props->power = FB_BLANK_UNBLANK;
 	bd->props->update_status(bd);
-	down(&bd->sem);
+	up(&bd->sem);
 
 #ifdef CONFIG_PMAC_BACKLIGHT
 	mutex_lock(&pmac_backlight_mutex);
diff -Nrup --exclude-from linux-exclude-from linux-2.6.18-rc5.orig/drivers/video/aty/radeon_backlight.c linux-2.6.18-rc5/drivers/video/aty/radeon_backlight.c
--- linux-2.6.18-rc5.orig/drivers/video/aty/radeon_backlight.c	2006-08-29 22:27:01.000000000 +0200
+++ linux-2.6.18-rc5/drivers/video/aty/radeon_backlight.c	2006-08-29 22:39:23.000000000 +0200
@@ -195,11 +195,11 @@ void radeonfb_bl_init(struct radeonfb_in
 		217 * FB_BACKLIGHT_MAX / MAX_RADEON_LEVEL);
 	mutex_unlock(&rinfo->info->bl_mutex);
 
-	up(&bd->sem);
+	down(&bd->sem);
 	bd->props->brightness = radeon_bl_data.max_brightness;
 	bd->props->power = FB_BLANK_UNBLANK;
 	bd->props->update_status(bd);
-	down(&bd->sem);
+	up(&bd->sem);
 
 #ifdef CONFIG_PMAC_BACKLIGHT
 	mutex_lock(&pmac_backlight_mutex);
diff -Nrup --exclude-from linux-exclude-from linux-2.6.18-rc5.orig/drivers/video/nvidia/nv_backlight.c linux-2.6.18-rc5/drivers/video/nvidia/nv_backlight.c
--- linux-2.6.18-rc5.orig/drivers/video/nvidia/nv_backlight.c	2006-08-29 22:27:01.000000000 +0200
+++ linux-2.6.18-rc5/drivers/video/nvidia/nv_backlight.c	2006-08-29 22:43:03.000000000 +0200
@@ -113,10 +113,10 @@ static struct backlight_properties nvidi
 void nvidia_bl_set_power(struct fb_info *info, int power)
 {
 	mutex_lock(&info->bl_mutex);
-	up(&info->bl_dev->sem);
+	down(&info->bl_dev->sem);
 	info->bl_dev->props->power = power;
 	__nvidia_bl_update_status(info->bl_dev);
-	down(&info->bl_dev->sem);
+	up(&info->bl_dev->sem);
 	mutex_unlock(&info->bl_mutex);
 }
 
@@ -151,11 +151,11 @@ void nvidia_bl_init(struct nvidia_par *p
 		0x534 * FB_BACKLIGHT_MAX / MAX_LEVEL);
 	mutex_unlock(&info->bl_mutex);
 
-	up(&bd->sem);
+	down(&bd->sem);
 	bd->props->brightness = nvidia_bl_data.max_brightness;
 	bd->props->power = FB_BLANK_UNBLANK;
 	bd->props->update_status(bd);
-	down(&bd->sem);
+	up(&bd->sem);
 
 #ifdef CONFIG_PMAC_BACKLIGHT
 	mutex_lock(&pmac_backlight_mutex);
diff -Nrup --exclude-from linux-exclude-from linux-2.6.18-rc5.orig/drivers/video/riva/fbdev.c linux-2.6.18-rc5/drivers/video/riva/fbdev.c
--- linux-2.6.18-rc5.orig/drivers/video/riva/fbdev.c	2006-08-29 22:27:01.000000000 +0200
+++ linux-2.6.18-rc5/drivers/video/riva/fbdev.c	2006-08-29 22:43:26.000000000 +0200
@@ -355,10 +355,10 @@ static struct backlight_properties riva_
 static void riva_bl_set_power(struct fb_info *info, int power)
 {
 	mutex_lock(&info->bl_mutex);
-	up(&info->bl_dev->sem);
+	down(&info->bl_dev->sem);
 	info->bl_dev->props->power = power;
 	__riva_bl_update_status(info->bl_dev);
-	down(&info->bl_dev->sem);
+	up(&info->bl_dev->sem);
 	mutex_unlock(&info->bl_mutex);
 }
 
@@ -393,11 +393,11 @@ static void riva_bl_init(struct riva_par
 		0x534 * FB_BACKLIGHT_MAX / MAX_LEVEL);
 	mutex_unlock(&info->bl_mutex);
 
-	up(&bd->sem);
+	down(&bd->sem);
 	bd->props->brightness = riva_bl_data.max_brightness;
 	bd->props->power = FB_BLANK_UNBLANK;
 	bd->props->update_status(bd);
-	down(&bd->sem);
+	up(&bd->sem);
 
 #ifdef CONFIG_PMAC_BACKLIGHT
 	mutex_lock(&pmac_backlight_mutex);
-
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