* [PATCH] ipmi: Fix memory leak in __ipmi_bmc_register
@ 2019-10-21 20:06 Navid Emamdoost
2019-10-22 15:49 ` Corey Minyard
0 siblings, 1 reply; 2+ messages in thread
From: Navid Emamdoost @ 2019-10-21 20:06 UTC (permalink / raw)
Cc: emamd001, kjlu, smccaman, Navid Emamdoost, Corey Minyard,
Arnd Bergmann, Greg Kroah-Hartman, openipmi-developer,
linux-kernel
In the impelementation of __ipmi_bmc_register() the allocated memory for
bmc should be released in case ida_simple_get() fails.
Fixes: 68e7e50f195f ("ipmi: Don't use BMC product/dev ids in the BMC name")
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
drivers/char/ipmi/ipmi_msghandler.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
index 2aab80e19ae0..e4928ed46396 100644
--- a/drivers/char/ipmi/ipmi_msghandler.c
+++ b/drivers/char/ipmi/ipmi_msghandler.c
@@ -3031,8 +3031,11 @@ static int __ipmi_bmc_register(struct ipmi_smi *intf,
bmc->pdev.name = "ipmi_bmc";
rv = ida_simple_get(&ipmi_bmc_ida, 0, 0, GFP_KERNEL);
- if (rv < 0)
+ if (rv < 0) {
+ kfree(bmc);
goto out;
+ }
+
bmc->pdev.dev.driver = &ipmidriver.driver;
bmc->pdev.id = rv;
bmc->pdev.dev.release = release_bmc_device;
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ipmi: Fix memory leak in __ipmi_bmc_register
2019-10-21 20:06 [PATCH] ipmi: Fix memory leak in __ipmi_bmc_register Navid Emamdoost
@ 2019-10-22 15:49 ` Corey Minyard
0 siblings, 0 replies; 2+ messages in thread
From: Corey Minyard @ 2019-10-22 15:49 UTC (permalink / raw)
To: Navid Emamdoost
Cc: emamd001, kjlu, smccaman, Arnd Bergmann, Greg Kroah-Hartman,
openipmi-developer, linux-kernel
On Mon, Oct 21, 2019 at 03:06:48PM -0500, Navid Emamdoost wrote:
> In the impelementation of __ipmi_bmc_register() the allocated memory for
> bmc should be released in case ida_simple_get() fails.
Thanks, queued for next merge window.
-corey
>
> Fixes: 68e7e50f195f ("ipmi: Don't use BMC product/dev ids in the BMC name")
> Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
> ---
> drivers/char/ipmi/ipmi_msghandler.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c
> index 2aab80e19ae0..e4928ed46396 100644
> --- a/drivers/char/ipmi/ipmi_msghandler.c
> +++ b/drivers/char/ipmi/ipmi_msghandler.c
> @@ -3031,8 +3031,11 @@ static int __ipmi_bmc_register(struct ipmi_smi *intf,
> bmc->pdev.name = "ipmi_bmc";
>
> rv = ida_simple_get(&ipmi_bmc_ida, 0, 0, GFP_KERNEL);
> - if (rv < 0)
> + if (rv < 0) {
> + kfree(bmc);
> goto out;
> + }
> +
> bmc->pdev.dev.driver = &ipmidriver.driver;
> bmc->pdev.id = rv;
> bmc->pdev.dev.release = release_bmc_device;
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-10-22 15:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-21 20:06 [PATCH] ipmi: Fix memory leak in __ipmi_bmc_register Navid Emamdoost
2019-10-22 15:49 ` Corey Minyard
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.