Re: [PATCH v2 1/2] EDAC/device_sysfs: Reject poll_msec value 0
From: Borislav Petkov
Date: Thu Jul 30 2026 - 01:15:49 EST
On Fri, Jul 10, 2026 at 12:35:47PM +0100, Jad Keskes wrote:
> 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 <inasj268@xxxxxxxxx>
> ---
> drivers/edac/edac_device_sysfs.c | 3 +++
> 1 file changed, 3 insertions(+)
Thanks for those, definitely better.
However, Sashiko found more crud:
https://sashiko.dev/#/patchset/20260710113548.46266-1-inasj268%40gmail.com
That thing in edac_device_ctl_poll_msec_store() should not do unsigned longs
and then stuff them into a uint. I guess we didn't have the kstrtox-etc
helpers back then...
I think you should convert it to kstrtouint() directly and then deal with
the value in the proper range.
And then the other reported issues would be good to address too.
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette