[PATCH v2 1/2] EDAC/device_sysfs: Reject poll_msec value 0
Jad Keskes <[email protected]> Fri, 10 Jul 2026 12:35:47 +0100
| Newsgroups | org.kernel.vger.linux-edac,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
The poll_msec store allows writing 0, which sets the workqueue delay
to 0 jiffies. This causes the poll work to spin without any delay,
consuming 100% CPU on the polling kworker.
The comment has said "must be at least one millisecond" since the file
was first added, but no validation was ever enforced. Add a check for
value < 1 and return -EINVAL.
Fixes: e27e3dac6517 ("drivers/edac: add edac_device class")
Signed-off-by: Jad Keskes <[email protected]>
---
drivers/edac/edac_device_sysfs.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/edac/edac_device_sysfs.c b/drivers/edac/edac_device_sysfs.c
index b1c2717cd023..89adfd3091e0 100644
--- a/drivers/edac/edac_device_sysfs.c
+++ b/drivers/edac/edac_device_sysfs.c
@@ -96,6 +96,9 @@ static ssize_t edac_device_ctl_poll_msec_store(struct edac_device_ctl_info
* and set a new one.
*/
value = simple_strtoul(data, NULL, 0);
+ if (value < 1)
+ return -EINVAL;
+
edac_device_reset_delay_period(ctl_info, value);
return count;
--
2.55.0