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-next>] [day] [month] [year] [list]
Message-Id: <200711182049.33355.eike-kernel@sf-tec.de>
Date:	Sun, 18 Nov 2007 20:49:24 +0100
From:	Rolf Eike Beer <eike-kernel@...tec.de>
To:	lenb@...nel.org
Cc:	linux-acpi@...r.kernel.org, astarikovskiy@...e.de,
	kernel list <linux-kernel@...r.kernel.org>
Subject: [PATCH] Fix segfault when printing battery status

cat /sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:19/PNP0C0A:00/power_supply/BAT1/status

This leads to a stacktrace as acpi_battery_get_property() returns 0 for a 
case where it does not set val->intval. These value is used as an array 
index in drivers/power/power_supply_sysfs.c::power_supply_show_property(). 
I had a situation where the value was 4096 which caused a problem as the 
array only has 5 entries.

Signed-off-by: Rolf Eike Beer <eike-kernel@...tec.de>

diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 192c244..2e8e790 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -153,6 +153,8 @@ static int acpi_battery_get_property(struct power_supply *psy,
 			val->intval = POWER_SUPPLY_STATUS_CHARGING;
 		else if (battery->state == 0)
 			val->intval = POWER_SUPPLY_STATUS_FULL;
+		else
+			val->intval = POWER_SUPPLY_STATUS_UNKNOWN;
 		break;
 	case POWER_SUPPLY_PROP_PRESENT:
 		val->intval = acpi_battery_present(battery);

Download attachment "signature.asc " of type "application/pgp-signature" (195 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ