Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

power: supply: sysfs: ratelimit property read error message

This adds rate limiting to the message that is printed when reading a
power supply property via sysfs returns an error. This will prevent
userspace applications from unintentionally dDOSing the system by
continuously reading a property that returns an error.

Signed-off-by: David Lechner <david@lechnology.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>

authored by

David Lechner and committed by
Sebastian Reichel
87a2b65f ae6fe7a3

+2 -1
+2 -1
drivers/power/supply/power_supply_sysfs.c
··· 131 131 dev_dbg(dev, "driver has no data for `%s' property\n", 132 132 attr->attr.name); 133 133 else if (ret != -ENODEV && ret != -EAGAIN) 134 - dev_err(dev, "driver failed to report `%s' property: %zd\n", 134 + dev_err_ratelimited(dev, 135 + "driver failed to report `%s' property: %zd\n", 135 136 attr->attr.name, ret); 136 137 return ret; 137 138 }