Re: [PATCH 7/8] watchdog: core: Fix unbalanced module_put() in watchdog_open()

From: Tzung-Bi Shih

Date: Wed Sep 30 2026 - 07:56:04 EST


On Tue, Sep 29, 2026 at 06:46:34AM -0700, Guenter Roeck wrote:
> If the hardware watchdog is running (hw_running is true), try_module_get()
> is skipped. However, if watchdog_start() then fails, the code jumps to
> out_mod and unconditionally calls module_put().
>
> This can cause a premature driver module unload while hardware timers or
> interrupts are active by dropping a reference that was never acquired.
>
> Only call module_put() if the hardware watchdog is not running to fix the
> problem.
>
> Fixes: ee142889e32f ("watchdog: Introduce WDOG_HW_RUNNING flag")
> Assisted-by: LLM
> Signed-off-by: Guenter Roeck <linux@xxxxxxxxxxxx>

Reviewed-by: Tzung-Bi Shih <tzungbi@xxxxxxxxxx>