All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] workqueue: reject watchdog thresholds that overflow jiffies
@ 2026-08-25  6:48 Jiacheng Xu
  2026-08-25  7:03 ` [PATCH RESEND] " Jiacheng Xu
  0 siblings, 1 reply; 3+ messages in thread
From: Jiacheng Xu @ 2026-08-25  6:48 UTC (permalink / raw)
  To: Tejun Heo; +Cc: Lai Jiangshan, linux-kernel, m0ck1ng

From: m0ck1ng <stitch@zju.edu.cn>

The watchdog threshold is supplied in seconds but is multiplied by HZ
before being used as a jiffies interval. Reject values that exceed
MAX_JIFFY_OFFSET / HZ so the multiplication cannot wrap and the
time_after() comparisons remain within their supported range.

The check is performed before changing the threshold or watchdog timer.
Zero remains the value used to disable the watchdog.

Fixes: 82607adcf9cdf ("workqueue: implement lockup detector")
Signed-off-by: m0ck1ng <stitch@zju.edu.cn>
---
 kernel/workqueue.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index bfeef512f6dd..3ea568807f26 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -8026,6 +8026,9 @@ static int wq_watchdog_param_set_thresh(const char *val,
        if (ret)
                return ret;

+       if (thresh > MAX_JIFFY_OFFSET / HZ)
+               return -ERANGE;
+
        if (system_percpu_wq)
                wq_watchdog_set_thresh(thresh);
        else
--
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH RESEND] workqueue: reject watchdog thresholds that overflow jiffies
  2026-08-25  6:48 [PATCH] workqueue: reject watchdog thresholds that overflow jiffies Jiacheng Xu
@ 2026-08-25  7:03 ` Jiacheng Xu
  2026-08-31 17:33   ` Tejun Heo
  0 siblings, 1 reply; 3+ messages in thread
From: Jiacheng Xu @ 2026-08-25  7:03 UTC (permalink / raw)
  To: Tejun Heo; +Cc: Lai Jiangshan, linux-kernel, Jiacheng Xu

The watchdog threshold is supplied in seconds but is multiplied by HZ
before being used as a jiffies interval. Reject values that exceed
MAX_JIFFY_OFFSET / HZ so the multiplication cannot wrap and the
time_after() comparisons remain within their supported range.

The check is performed before changing the threshold or watchdog timer.
Zero remains the value used to disable the watchdog.

Fixes: 82607adcf9cdf ("workqueue: implement lockup detector")
Signed-off-by: Jiacheng Xu <stitch@zju.edu.cn>
---
 kernel/workqueue.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index bfeef512f6dd..3ea568807f26 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -8026,6 +8026,9 @@ static int wq_watchdog_param_set_thresh(const char *val,
        if (ret)
                return ret;

+       if (thresh > MAX_JIFFY_OFFSET / HZ)
+               return -ERANGE;
+
        if (system_percpu_wq)
                wq_watchdog_set_thresh(thresh);
        else
--
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH RESEND] workqueue: reject watchdog thresholds that overflow jiffies
  2026-08-25  7:03 ` [PATCH RESEND] " Jiacheng Xu
@ 2026-08-31 17:33   ` Tejun Heo
  0 siblings, 0 replies; 3+ messages in thread
From: Tejun Heo @ 2026-08-31 17:33 UTC (permalink / raw)
  To: Jiacheng Xu; +Cc: Lai Jiangshan, linux-kernel

The posted patch was whitespace-damaged (tabs expanded to spaces) and
didn't apply as-is. Restored the tabs and applied to wq/for-7.3-fixes.
Please fix up the email setup for future postings.

Thanks.

--
tejun

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-08-31 17:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-25  6:48 [PATCH] workqueue: reject watchdog thresholds that overflow jiffies Jiacheng Xu
2026-08-25  7:03 ` [PATCH RESEND] " Jiacheng Xu
2026-08-31 17:33   ` Tejun Heo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.