[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220818165543.GA923105@roeck-us.net>
Date: Thu, 18 Aug 2022 09:55:43 -0700
From: Guenter Roeck <linux@...ck-us.net>
To: Alexey Klimov <aklimov@...hat.com>
Cc: linux-watchdog@...r.kernel.org, wim@...ux-watchdog.org,
linux-kernel@...r.kernel.org, klimov.linux@...il.com
Subject: Re: [PATCH REVIEW 1/2] watchdog: extend the mutex-protected section
in watchdog_cdev_unregister()
On Thu, Aug 18, 2022 at 03:06:23AM +0100, Alexey Klimov wrote:
> watchdog_stop() should be called with wd_data->lock mutex locked.
> Updates to wdd->status also occur under this look throughout the
> watchdog_dev.c as well as functions that deal with pretimeout hrtimer
> like watchdog_hrtimer_pretimeout_stop() here.
>
What actual problems are you fixing here ?
Guenter
> Signed-off-by: Alexey Klimov <aklimov@...hat.com>
> ---
> drivers/watchdog/watchdog_dev.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c
> index 54903f3c851e..804236a094f6 100644
> --- a/drivers/watchdog/watchdog_dev.c
> +++ b/drivers/watchdog/watchdog_dev.c
> @@ -1095,6 +1095,8 @@ static void watchdog_cdev_unregister(struct watchdog_device *wdd)
> old_wd_data = NULL;
> }
>
> + mutex_lock(&wd_data->lock);
> +
> if (watchdog_active(wdd) &&
> test_bit(WDOG_STOP_ON_UNREGISTER, &wdd->status)) {
> watchdog_stop(wdd);
> @@ -1102,7 +1104,6 @@ static void watchdog_cdev_unregister(struct watchdog_device *wdd)
>
> watchdog_hrtimer_pretimeout_stop(wdd);
>
> - mutex_lock(&wd_data->lock);
> wd_data->wdd = NULL;
> wdd->wd_data = NULL;
> mutex_unlock(&wd_data->lock);
> --
> 2.37.2
>
Powered by blists - more mailing lists