lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <34972d36-74bc-7c9a-4ae1-67d484dab41a@roeck-us.net>
Date:   Tue, 4 Apr 2017 09:39:06 -0700
From:   Guenter Roeck <linux@...ck-us.net>
To:     Andrey Smirnov <andrew.smirnov@...il.com>,
        linux-watchdog@...r.kernel.org
Cc:     cphealy@...il.com, linux-kernel@...r.kernel.org,
        Wim Van Sebroeck <wim@...ana.be>,
        Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] watchdog: core: Make use of
 devm_register_reboot_notifier()

On 04/04/2017 07:10 AM, Andrey Smirnov wrote:
> Save a bit of cleanup code by leveraging newly added
> devm_register_reboot_notifier().
>
> Cc: cphealy@...il.com
> Cc: linux-kernel@...r.kernel.org
> Cc: Wim Van Sebroeck <wim@...ana.be>
> Cc: Guenter Roeck <linux@...ck-us.net>
> Cc: Andrew Morton <akpm@...ux-foundation.org>
> Signed-off-by: Andrey Smirnov <andrew.smirnov@...il.com>
> ---
>
> All:
>
> This patch is a follow up to this thread
> https://lkml.org/lkml/2017/3/20/671. I am not sure what's the best way
> to manager cross-tree dependency here, so, if there's something to be
> done, please let me know.
>
> Thanks,
> Andrey Smirnov
>
>  drivers/watchdog/watchdog_core.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/watchdog/watchdog_core.c b/drivers/watchdog/watchdog_core.c
> index 74265b2..9d868f1 100644
> --- a/drivers/watchdog/watchdog_core.c
> +++ b/drivers/watchdog/watchdog_core.c
> @@ -247,7 +247,8 @@ static int __watchdog_register_device(struct watchdog_device *wdd)
>  	if (test_bit(WDOG_STOP_ON_REBOOT, &wdd->status)) {
>  		wdd->reboot_nb.notifier_call = watchdog_reboot_notifier;
>
> -		ret = register_reboot_notifier(&wdd->reboot_nb);
> +		ret = devm_register_reboot_notifier(wdd->parent,
> +						    &wdd->reboot_nb);

I like the idea, but unfortunately wdd->parent can be NULL. Also, this would result
in the notifier being removed _after_ the watchdog device has been removed, which
would be bad as well.

Guenter

>  		if (ret) {
>  			pr_err("watchdog%d: Cannot register reboot notifier (%d)\n",
>  			       wdd->id, ret);
> @@ -302,9 +303,6 @@ static void __watchdog_unregister_device(struct watchdog_device *wdd)
>  	if (wdd->ops->restart)
>  		unregister_restart_handler(&wdd->restart_nb);
>
> -	if (test_bit(WDOG_STOP_ON_REBOOT, &wdd->status))
> -		unregister_reboot_notifier(&wdd->reboot_nb);
> -
>  	watchdog_dev_unregister(wdd);
>  	ida_simple_remove(&watchdog_ida, wdd->id);
>  }
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ