Re: [PATCH] watchdog: airoha: validate heartbeat module parameter
Wayen Yan <[email protected]> Wed, 08 Jul 2026 13:55:12 +0800
| Newsgroups | org.kernel.vger.linux-watchdog,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
Please do not apply the above patch. It introduces a regression: The patch removes the direct assignment "wdog_dev->timeout = heartbeat" and relies on watchdog_init_timeout() instead. However, since wdog_dev is allocated via devm_kzalloc(), timeout is initialized to 0. If the heartbeat module parameter is invalid and there is no "timeout-sec" DT property, watchdog_init_timeout() returns -EINVAL and leaves timeout at 0. When the watchdog is subsequently started, airoha_wdt_start() writes 0 * wdt_freq = 0 to WDT_TIMER_LOAD_VALUE, causing an immediate hardware reboot — which is worse than the original overflow bug. I will send a v2 patch that: 1. Pre-initializes timeout to WDT_HEARTBEAT before calling watchdog_init_timeout(), so the safe default is preserved on failure 2. Sets min_timeout = 1 to prevent timeout = 0 via ioctl Sorry for the noise. Wayen