summaryrefslogtreecommitdiffstats
path: root/drivers/base/power
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2017-07-10 09:21:40 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-07-12 14:42:37 +0200
commit2ca30331c156ca9e97643ad05dd8930b8fe78b01 (patch)
tree8c5768fcd1d7c13278b27fcbfcaf83d48683a228 /drivers/base/power
parentPM / QoS: constify *_attribute_group. (diff)
downloadlinux-2ca30331c156ca9e97643ad05dd8930b8fe78b01.tar.xz
linux-2ca30331c156ca9e97643ad05dd8930b8fe78b01.zip
PM / QoS: return -EINVAL for bogus strings
In the current code, if the user accidentally writes a bogus command to this sysfs file, then we set the latency tolerance to an uninitialized variable. Fixes: 2d984ad132a8 (PM / QoS: Introcuce latency tolerance device PM QoS type) Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Pavel Machek <pavel@ucw.cz> Cc: 3.15+ <stable@vger.kernel.org> # 3.15+ Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/base/power')
-rw-r--r--drivers/base/power/sysfs.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/base/power/sysfs.c b/drivers/base/power/sysfs.c
index 185a52581cfa..156ab57bca77 100644
--- a/drivers/base/power/sysfs.c
+++ b/drivers/base/power/sysfs.c
@@ -272,6 +272,8 @@ static ssize_t pm_qos_latency_tolerance_store(struct device *dev,
value = PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT;
else if (!strcmp(buf, "any") || !strcmp(buf, "any\n"))
value = PM_QOS_LATENCY_ANY;
+ else
+ return -EINVAL;
}
ret = dev_pm_qos_update_user_latency_tolerance(dev, value);
return ret < 0 ? ret : n;