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] [day] [month] [year] [list]
Message-ID: <20211217204211.GM14936@minyard.net>
Date:   Fri, 17 Dec 2021 14:42:11 -0600
From:   Corey Minyard <minyard@....org>
To:     Thadeu Lima de Souza Cascardo <cascardo@...onical.com>
Cc:     openipmi-developer@...ts.sourceforge.net,
        linux-kernel@...r.kernel.org,
        ioanna-maria.alifieraki@...onical.com, minyard@...sta.com,
        stable@...r.kernel.org
Subject: Re: [PATCH 2/2] ipmi: fix initialization when workqueue allocation
 fails

Thanks for this, I need to be more careful about looking at code and not
just looking at patches.  Both in my queue, I'll try to get them in to
5.16.

-corey

On Fri, Dec 17, 2021 at 12:44:10PM -0300, Thadeu Lima de Souza Cascardo wrote:
> If the workqueue allocation fails, the driver is marked as not initialized,
> and timer and panic_notifier will be left registered.
> 
> Instead of removing those when workqueue allocation fails, do the workqueue
> initialization before doing it, and cleanup srcu_struct if it fails.
> 
> Fixes: 1d49eb91e86e ("ipmi: Move remove_work to dedicated workqueue")
> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@...onical.com>
> Cc: Corey Minyard <cminyard@...sta.com>
> Cc: Ioanna Alifieraki <ioanna-maria.alifieraki@...onical.com>
> Cc: stable@...r.kernel.org
> ---
>  drivers/char/ipmi/ipmi_msghandler.c | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
> index 84975b21fff2..266c7bc58dda 100644
> --- a/drivers/char/ipmi/ipmi_msghandler.c
> +++ b/drivers/char/ipmi/ipmi_msghandler.c
> @@ -5396,20 +5396,23 @@ static int ipmi_init_msghandler(void)
>  	if (rv)
>  		goto out;
>  
> -	timer_setup(&ipmi_timer, ipmi_timeout, 0);
> -	mod_timer(&ipmi_timer, jiffies + IPMI_TIMEOUT_JIFFIES);
> -
> -	atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
> -
>  	remove_work_wq = create_singlethread_workqueue("ipmi-msghandler-remove-wq");
>  	if (!remove_work_wq) {
>  		pr_err("unable to create ipmi-msghandler-remove-wq workqueue");
>  		rv = -ENOMEM;
> -		goto out;
> +		goto out_wq;
>  	}
>  
> +	timer_setup(&ipmi_timer, ipmi_timeout, 0);
> +	mod_timer(&ipmi_timer, jiffies + IPMI_TIMEOUT_JIFFIES);
> +
> +	atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
> +
>  	initialized = true;
>  
> +out_wq:
> +	if (rv)
> +		cleanup_srcu_struct(&ipmi_interfaces_srcu);
>  out:
>  	mutex_unlock(&ipmi_interfaces_mutex);
>  	return rv;
> -- 
> 2.32.0
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ