Skip to content

Commit

Permalink
ipmi: bail out if init_srcu_struct fails
Browse files Browse the repository at this point in the history
commit 2b5160b upstream.

In case, init_srcu_struct fails (because of memory allocation failure), we
might proceed with the driver initialization despite srcu_struct not being
entirely initialized.

Fixes: 913a89f ("ipmi: Don't initialize anything in the core until something uses it")
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Cc: Corey Minyard <cminyard@mvista.com>
Cc: stable@vger.kernel.org
Message-Id: <20211217154410.1228673-1-cascardo@canonical.com>
Signed-off-by: Corey Minyard <cminyard@mvista.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Thadeu Lima de Souza Cascardo authored and gregkh committed Dec 29, 2021
1 parent bc674f1 commit a5192f3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/char/ipmi/ipmi_msghandler.c
Expand Up @@ -5161,7 +5161,9 @@ static int ipmi_init_msghandler(void)
if (initialized)
goto out;

init_srcu_struct(&ipmi_interfaces_srcu);
rv = init_srcu_struct(&ipmi_interfaces_srcu);
if (rv)
goto out;

timer_setup(&ipmi_timer, ipmi_timeout, 0);
mod_timer(&ipmi_timer, jiffies + IPMI_TIMEOUT_JIFFIES);
Expand Down

0 comments on commit a5192f3

Please sign in to comment.