diff options
author | Darrick J. Wong <djwong@us.ibm.com> | 2009-10-22 03:01:37 +0200 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2009-11-05 18:25:39 +0100 |
commit | 22aecebfd9498c4779e5c5bed1d2d054bd99f7a4 (patch) | |
tree | 8fbb3ee3c1e49fd8736acd391aaaca350cb27c54 /drivers/acpi/power_meter.c | |
parent | ACPI: clean up video.c boundary checks and types (diff) | |
download | linux-22aecebfd9498c4779e5c5bed1d2d054bd99f7a4.tar.xz linux-22aecebfd9498c4779e5c5bed1d2d054bd99f7a4.zip |
acpi-power-meter: Don't leak ACPI error codes to userspace
If the ACPI methods return an error code, we must return -EINVAL to userspace
to flag the error. Right now we pass the (positive) number right through,
which causes echo to keep writing bogus values.
Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/power_meter.c')
-rw-r--r-- | drivers/acpi/power_meter.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/acpi/power_meter.c b/drivers/acpi/power_meter.c index e6bfd77986b8..2ef7030a0c28 100644 --- a/drivers/acpi/power_meter.c +++ b/drivers/acpi/power_meter.c @@ -294,7 +294,11 @@ static int set_acpi_trip(struct acpi_power_meter_resource *resource) return -EINVAL; } - return data; + /* _PTP returns 0 on success, nonzero otherwise */ + if (data) + return -EINVAL; + + return 0; } static ssize_t set_trip(struct device *dev, struct device_attribute *devattr, |