The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Corey Minyard <corey@minyard.net>
To: Michail Tatas <michail.tatas@gmail.com>
Cc: openipmi-developer@lists.sourceforge.net, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ipmi: Fix leak in __ipmi_bmc_register
Date: Thu, 6 Aug 2026 18:56:28 -0500	[thread overview]
Message-ID: <anUfLCLeEK58zv4Y@mail.minyard.net> (raw)
In-Reply-To: <anUK_HOy_pCgvsBm@michalis-linux>

On Fri, Aug 07, 2026 at 01:30:20AM +0300, Michail Tatas wrote:
> In case that ida_alloc(&ipmi_bmc_ida,...) succeeds and then
> platform_device_register() fails, ipmi_bmc_ida is leaked.
> Fix by freeing the error path

You are correct, added to my next tree.  Thank you.

-corey

> 
> Signed-off-by: Michail Tatas <michail.tatas@gmail.com>
> ---
>  drivers/char/ipmi/ipmi_msghandler.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
> index 6ff9a15cced8..7634dff99f41 100644
> --- a/drivers/char/ipmi/ipmi_msghandler.c
> +++ b/drivers/char/ipmi/ipmi_msghandler.c
> @@ -3301,6 +3301,7 @@ static int __ipmi_bmc_register(struct ipmi_smi *intf,
>  	list_del(&intf->bmc_link);
>  	mutex_unlock(&bmc->dyn_mutex);
>  	intf->bmc = &intf->tmp_bmc;
> +	ida_free(&ipmi_bmc_ida, bmc->pdev.id);
>  	put_device(&bmc->pdev.dev);
>  	goto out;
>  }
> -- 
> 2.43.0
> 

      reply	other threads:[~2026-08-06 23:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-06 22:30 [PATCH] ipmi: Fix leak in __ipmi_bmc_register Michail Tatas
2026-08-06 23:56 ` 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=anUfLCLeEK58zv4Y@mail.minyard.net \
    --to=corey@minyard.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michail.tatas@gmail.com \
    --cc=openipmi-developer@lists.sourceforge.net \
    /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