[patch 43/67] backlight: fix oops in __mutex_lock_slowpath during head /sys/class/graphics/fb0/bits_per_pixel /sys/class/graphics/fb0/blank /sys/class/graphics/fb0/console /sys/class/graphics/fb0/cursor /sys/class/graphics/fb0/dev /sys/class/graphics/fb0/device /sys/class/graphics/fb0/mode /sys/class/graphics/fb0/modes /sys/class/graphics/fb0/name /sys/class/graphics/fb0/pan /sys/class/graphics/fb0/rotate /sys/class/graphics/fb0/state /sys/class/graphics/fb0/stride /sys/class/graphics/fb0/subsystem /sys/class/graphics/fb0/uevent /sys/class/graphics/fb0/virtual_size

From: Greg KH
Date: Wed Oct 11 2006 - 17:19:05 EST



-stable review patch. If anyone has any objections, please let us know.

------------------
From: Michael Hanselmann <linux-kernel@xxxxxxxxx>

Seems like not all drivers use the framebuffer_alloc() function and won't
have an initialized mutex. But those don't have a backlight, anyway.

Signed-off-by: Michael Hanselmann <linux-kernel@xxxxxxxxx>
Cc: Olaf Hering <olaf@xxxxxxxxx>
Cc: "Antonino A. Daplas" <adaplas@xxxxxxx>
Cc: Daniel R Thompson <daniel.thompson@xxxxxx>
Cc: Jon Smirl <jonsmirl@xxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>

---
drivers/video/fbsysfs.c | 12 ++++++++++++
1 file changed, 12 insertions(+)

--- linux-2.6.18.orig/drivers/video/fbsysfs.c
+++ linux-2.6.18/drivers/video/fbsysfs.c
@@ -397,6 +397,12 @@ static ssize_t store_bl_curve(struct cla
u8 tmp_curve[FB_BACKLIGHT_LEVELS];
unsigned int i;

+ /* Some drivers don't use framebuffer_alloc(), but those also
+ * don't have backlights.
+ */
+ if (!fb_info || !fb_info->bl_dev)
+ return -ENODEV;
+
if (count != (FB_BACKLIGHT_LEVELS / 8 * 24))
return -EINVAL;

@@ -430,6 +436,12 @@ static ssize_t show_bl_curve(struct clas
ssize_t len = 0;
unsigned int i;

+ /* Some drivers don't use framebuffer_alloc(), but those also
+ * don't have backlights.
+ */
+ if (!fb_info || !fb_info->bl_dev)
+ return -ENODEV;
+
mutex_lock(&fb_info->bl_mutex);
for (i = 0; i < FB_BACKLIGHT_LEVELS; i += 8)
len += snprintf(&buf[len], PAGE_SIZE,

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