summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiacheng Xu <stitch@zju.edu.cn>2026-08-25 15:03:15 +0800
committerTejun Heo <tj@kernel.org>2026-08-31 07:31:46 -1000
commit068c35b5d0546c8625b3d7c61910f73775cf1216 (patch)
tree68550bc15545b7ab677c676ef280300a55f4eef0
parentcf9c8aaea0d47410df8708bec195889f3a85cd3c (diff)
workqueue: reject watchdog thresholds that overflow jiffies
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> Signed-off-by: Tejun Heo <tj@kernel.org>
-rw-r--r--kernel/workqueue.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 0ee73dcd4a14..b8bec1689b7a 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -8035,6 +8035,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