Re: [PATCH] ipmi: Fix leak in __ipmi_bmc_register

Corey Minyard <[email protected]>
Newsgroups org.kernel.vger.linux-kernel
Message-ID <[email protected]>
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 <[email protected]>
> ---
>  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
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.