提交 22aecebf 编写于 作者: D Darrick J. Wong 提交者: Len Brown

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: NDarrick J. Wong <djwong@us.ibm.com>
Acked-by: NJean Delvare <khali@linux-fr.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLen Brown <len.brown@intel.com>
上级 52a2b11c
...@@ -294,7 +294,11 @@ static int set_acpi_trip(struct acpi_power_meter_resource *resource) ...@@ -294,7 +294,11 @@ static int set_acpi_trip(struct acpi_power_meter_resource *resource)
return -EINVAL; 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, static ssize_t set_trip(struct device *dev, struct device_attribute *devattr,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册