[PATCH] disable _BQC/_BCQ if it returns invalid values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Validate the result of the _BQC or _BCQ method when querying the current
backlight level. If the value is out of range, the support for this
method is disabled. This does not break functionality as long as the
hardware doesn't touch the backlight level on it own, since the driver
will just use the last cached value.

Acer Aspire 8930G with BIOS v1.10 (latest) has this issue.

Signed-off-by: Hector Martin <hector@xxxxxxxxxxxxxx>
--- linux-2.6.30/drivers/acpi/video.c	2009-07-08 22:04:54.000000000 +0200
+++ linux-2.6.30-mod/drivers/acpi/video.c	2009-07-08 22:12:19.000000000 +0200
@@ -602,15 +605,29 @@ acpi_video_device_lcd_get_level_current(
 						NULL, level);
 		if (ACPI_SUCCESS(status)) {
 			if (device->brightness->flags._BQC_use_index) {
+				if (*level >= (device->brightness->count - 2)) {
+					ACPI_WARNING((AE_INFO,
+						"%s is broken (returned %llu)",
+						buf, *level));
+					device->cap._BQC = device->cap._BCQ = 0;
+					*level = device->brightness->curr;
+					return 0;
+				}
 				if (device->brightness->flags._BCL_reversed)
 					*level = device->brightness->count
 								 - 3 - (*level);
 				*level = device->brightness->levels[*level + 2];
 
 			}
-			*level += bqc_offset_aml_bug_workaround;
-			device->brightness->curr = *level;
-			return 0;
+			if (*level > 100) {
+				ACPI_WARNING((AE_INFO, "%s is broken "
+					"(returned %llu)", buf, *level));
+				device->cap._BQC = device->cap._BCQ = 0;
+			} else {
+				*level += bqc_offset_aml_bug_workaround;
+				device->brightness->curr = *level;
+				return 0;
+			}
 		} else {
 			/* Fixme:
 			 * should we return an error or ignore this failure?


-- 
Hector Martin (hector@xxxxxxxxxxxxxx)
Public Key: http://www.marcansoft.com/marcan.asc

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

[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux