[PATCH RESEND] workqueue: reject watchdog thresholds that overflow jiffies

From: Jiacheng Xu

Date: Tue Aug 25 2026 - 03:03:39 EST


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@xxxxxxxxxx>
---
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