From: Corey Minyard <minyard@acm.org>
To: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Cc: openipmi-developer@lists.sourceforge.net,
linux-kernel@vger.kernel.org,
ioanna-maria.alifieraki@canonical.com, minyard@mvista.com,
stable@vger.kernel.org
Subject: Re: [PATCH 2/2] ipmi: fix initialization when workqueue allocation fails
Date: Fri, 17 Dec 2021 14:42:11 -0600 [thread overview]
Message-ID: <20211217204211.GM14936@minyard.net> (raw)
In-Reply-To: <20211217154410.1228673-2-cascardo@canonical.com>
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@canonical.com>
> Cc: Corey Minyard <cminyard@mvista.com>
> Cc: Ioanna Alifieraki <ioanna-maria.alifieraki@canonical.com>
> Cc: stable@vger.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
>
prev parent reply other threads:[~2021-12-17 20:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-17 15:44 [PATCH 1/2] ipmi: bail out if init_srcu_struct fails Thadeu Lima de Souza Cascardo
2021-12-17 15:44 ` [PATCH 2/2] ipmi: fix initialization when workqueue allocation fails Thadeu Lima de Souza Cascardo
2021-12-17 20:42 ` Corey Minyard [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=20211217204211.GM14936@minyard.net \
--to=minyard@acm.org \
--cc=cascardo@canonical.com \
--cc=ioanna-maria.alifieraki@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=minyard@mvista.com \
--cc=openipmi-developer@lists.sourceforge.net \
--cc=stable@vger.kernel.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®