Skip to content

Commit 2ca3033

Browse files
Dan Carpenterrafaeljw
authored andcommitted
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: 2d984ad (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>
1 parent dbb1d8b commit 2ca3033

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/base/power/sysfs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,8 @@ static ssize_t pm_qos_latency_tolerance_store(struct device *dev,
272272
value = PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT;
273273
else if (!strcmp(buf, "any") || !strcmp(buf, "any\n"))
274274
value = PM_QOS_LATENCY_ANY;
275+
else
276+
return -EINVAL;
275277
}
276278
ret = dev_pm_qos_update_user_latency_tolerance(dev, value);
277279
return ret < 0 ? ret : n;

0 commit comments

Comments
 (0)