Re: [PATCH 2/8] watchdog: core: Add missing locks

From: Tzung-Bi Shih

Date: Wed Sep 30 2026 - 07:54:24 EST


On Tue, Sep 29, 2026 at 06:46:29AM -0700, Guenter Roeck wrote:
> Add missing locks to watchdog_open(), watchdog_cdev_unregister(), and
> watchdog_set_last_hw_keepalive(). Also protect old_wd_data with its own
> lock to prevent its modification while in use, acquiring wd_data->lock
> before releasing old_wd_data_lock in watchdog_open() to avoid a TOCTOU
> race, and keeping misc_deregister() outside old_wd_data_lock to avoid
> lock ordering inversion with misc_mtx.
>
> Fixes: b4ffb1909843 ("watchdog: Separate and maintain variables based on variable lifetime")
> Assisted-by: LLM
> Signed-off-by: Guenter Roeck <linux@xxxxxxxxxxxx>

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