Commit 4aa7afb0 authored by Navid Emamdoost's avatar Navid Emamdoost Committed by Corey Minyard

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: 68e7e50f ("ipmi: Don't use BMC product/dev ids in the BMC name")
Signed-off-by: default avatarNavid Emamdoost <navid.emamdoost@gmail.com>
Message-Id: <20191021200649.1511-1-navid.emamdoost@gmail.com>
Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
parent 2a21d858
...@@ -3020,8 +3020,11 @@ static int __ipmi_bmc_register(struct ipmi_smi *intf, ...@@ -3020,8 +3020,11 @@ static int __ipmi_bmc_register(struct ipmi_smi *intf,
bmc->pdev.name = "ipmi_bmc"; bmc->pdev.name = "ipmi_bmc";
rv = ida_simple_get(&ipmi_bmc_ida, 0, 0, GFP_KERNEL); rv = ida_simple_get(&ipmi_bmc_ida, 0, 0, GFP_KERNEL);
if (rv < 0) if (rv < 0) {
kfree(bmc);
goto out; goto out;
}
bmc->pdev.dev.driver = &ipmidriver.driver; bmc->pdev.dev.driver = &ipmidriver.driver;
bmc->pdev.id = rv; bmc->pdev.id = rv;
bmc->pdev.dev.release = release_bmc_device; bmc->pdev.dev.release = release_bmc_device;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment