Skip to content

Commit c17f651

Browse files
Dan Carpentergregkh
authored andcommitted
PM / QoS: return -EINVAL for bogus strings
commit 2ca30331c156ca9e97643ad05dd8930b8fe78b01 upstream. 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> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 275d4be commit c17f651

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/base/power/sysfs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,8 @@ static ssize_t pm_qos_latency_tolerance_store(struct device *dev,
268268
value = PM_QOS_LATENCY_TOLERANCE_NO_CONSTRAINT;
269269
else if (!strcmp(buf, "any") || !strcmp(buf, "any\n"))
270270
value = PM_QOS_LATENCY_ANY;
271+
else
272+
return -EINVAL;
271273
}
272274
ret = dev_pm_qos_update_user_latency_tolerance(dev, value);
273275
return ret < 0 ? ret : n;

0 commit comments

Comments
 (0)