From: Guenter Roeck <linux@roeck-us.net>
To: Alexey Klimov <aklimov@redhat.com>
Cc: linux-watchdog@vger.kernel.org, wim@linux-watchdog.org,
linux-kernel@vger.kernel.org, klimov.linux@gmail.com
Subject: Re: [PATCH REVIEW 1/2] watchdog: extend the mutex-protected section in watchdog_cdev_unregister()
Date: Thu, 18 Aug 2022 09:55:43 -0700 [thread overview]
Message-ID: <20220818165543.GA923105@roeck-us.net> (raw)
In-Reply-To: <20220818020624.2386475-1-aklimov@redhat.com>
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@redhat.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
>
prev parent reply other threads:[~2022-08-18 16:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-18 2:06 Alexey Klimov
2022-08-18 2:06 ` [PATCH REVIEW 2/2] watchdog: add wd_data->lock mutex locking to watchdog_open() Alexey Klimov
2022-08-18 9:09 ` Christophe Leroy
2022-08-18 16:57 ` Guenter Roeck
2022-08-18 16:55 ` Guenter Roeck [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220818165543.GA923105@roeck-us.net \
--to=linux@roeck-us.net \
--cc=aklimov@redhat.com \
--cc=klimov.linux@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=wim@linux-watchdog.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®