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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211202141630.rdkrtrltxhzdqtyb@linutronix.de>
Date:   Thu, 2 Dec 2021 15:16:30 +0100
From:   Sebastian Andrzej Siewior <bigeasy@...utronix.de>
To:     Borislav Petkov <bp@...en8.de>
Cc:     X86 ML <x86@...nel.org>,
        Valentin Schneider <valentin.schneider@....com>,
        "Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
        Geert Uytterhoeven <geert@...ux-m68k.org>,
        Alan Stern <stern@...land.harvard.edu>,
        Steven Rostedt <rostedt@...dmis.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] notifier: Return an error when a callback has already
 been registered

On 2021-12-02 14:36:01 [+0100], Borislav Petkov wrote:
> --- a/kernel/notifier.c
> +++ b/kernel/notifier.c
> @@ -19,14 +19,12 @@ BLOCKING_NOTIFIER_HEAD(reboot_notifier_list);
>   *	are layered on top of these, with appropriate locking added.
>   */
>  
> -static int notifier_chain_register(struct notifier_block **nl,
> -		struct notifier_block *n)
> +static int __notifier_chain_register(struct notifier_block **nl,
> +				     struct notifier_block *n)
>  {
>  	while ((*nl) != NULL) {
> -		if (unlikely((*nl) == n)) {
> -			WARN(1, "double register detected");
> -			return 0;

This could be s/0/-EEXIST/ or do I miss something?
I appreciate the updated warning with %ps!

> -		}
> +		if (unlikely((*nl) == n))
> +			return -EEXIST;
>  		if (n->priority > (*nl)->priority)
>  			break;
>  		nl = &((*nl)->next);

Sebastian

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ