Skip to content

Commit 4aa7afb

Browse files
Navidemcminyard
authored andcommitted
ipmi: Fix memory leak in __ipmi_bmc_register
In the impelementation of __ipmi_bmc_register() the allocated memory for bmc should be released in case ida_simple_get() fails. Fixes: 68e7e50 ("ipmi: Don't use BMC product/dev ids in the BMC name") Signed-off-by: Navid Emamdoost <[email protected]> Message-Id: <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
1 parent 2a21d85 commit 4aa7afb

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/char/ipmi/ipmi_msghandler.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3020,8 +3020,11 @@ static int __ipmi_bmc_register(struct ipmi_smi *intf,
30203020
bmc->pdev.name = "ipmi_bmc";
30213021

30223022
rv = ida_simple_get(&ipmi_bmc_ida, 0, 0, GFP_KERNEL);
3023-
if (rv < 0)
3023+
if (rv < 0) {
3024+
kfree(bmc);
30243025
goto out;
3026+
}
3027+
30253028
bmc->pdev.dev.driver = &ipmidriver.driver;
30263029
bmc->pdev.id = rv;
30273030
bmc->pdev.dev.release = release_bmc_device;

0 commit comments

Comments
 (0)