* [PATCH] ARM: OMAP2+: Fix possible memory leak in omap_hwmod_allocate_module
@ 2020-06-19 10:42 ` Chen Tao
0 siblings, 0 replies; 6+ messages in thread
From: Chen Tao @ 2020-06-19 10:42 UTC (permalink / raw)
To: paul, tony; +Cc: linux, linux-omap, linux-arm-kernel, linux-kernel, chentao107
Fix memory leak in omap_hwmod_allocate_module not freeing in
handling error path.
Fixes: 8c87970543b17("ARM: OMAP2+: Add functions to allocate module data from device tree")
Signed-off-by: Chen Tao <chentao107@huawei.com>
---
arch/arm/mach-omap2/omap_hwmod.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 82706af307de..d2667f28e68e 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -3435,7 +3435,7 @@ static int omap_hwmod_allocate_module(struct device *dev, struct omap_hwmod *oh,
regs = ioremap(data->module_pa,
data->module_size);
if (!regs)
- return -ENOMEM;
+ goto out_free_sysc;
}
/*
@@ -3445,13 +3445,13 @@ static int omap_hwmod_allocate_module(struct device *dev, struct omap_hwmod *oh,
if (oh->class->name && strcmp(oh->class->name, data->name)) {
class = kmemdup(oh->class, sizeof(*oh->class), GFP_KERNEL);
if (!class)
- return -ENOMEM;
+ goto out_unmap;
}
if (list_empty(&oh->slave_ports)) {
oi = kcalloc(1, sizeof(*oi), GFP_KERNEL);
if (!oi)
- return -ENOMEM;
+ goto out_free_class;
/*
* Note that we assume interconnect interface clocks will be
@@ -3478,6 +3478,14 @@ static int omap_hwmod_allocate_module(struct device *dev, struct omap_hwmod *oh,
spin_unlock_irqrestore(&oh->_lock, flags);
return 0;
+
+out_free_class:
+ kfree(class);
+out_unmap:
+ iounmap();
+out_free_sysc:
+ kfree(sysc);
+ return -ENOMEM;
}
static const struct omap_hwmod_reset omap24xx_reset_quirks[] = {
--
2.22.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] ARM: OMAP2+: Fix possible memory leak in omap_hwmod_allocate_module
@ 2020-06-19 10:42 ` Chen Tao
0 siblings, 0 replies; 6+ messages in thread
From: Chen Tao @ 2020-06-19 10:42 UTC (permalink / raw)
To: paul, tony; +Cc: chentao107, linux-omap, linux, linux-arm-kernel, linux-kernel
Fix memory leak in omap_hwmod_allocate_module not freeing in
handling error path.
Fixes: 8c87970543b17("ARM: OMAP2+: Add functions to allocate module data from device tree")
Signed-off-by: Chen Tao <chentao107@huawei.com>
---
arch/arm/mach-omap2/omap_hwmod.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 82706af307de..d2667f28e68e 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -3435,7 +3435,7 @@ static int omap_hwmod_allocate_module(struct device *dev, struct omap_hwmod *oh,
regs = ioremap(data->module_pa,
data->module_size);
if (!regs)
- return -ENOMEM;
+ goto out_free_sysc;
}
/*
@@ -3445,13 +3445,13 @@ static int omap_hwmod_allocate_module(struct device *dev, struct omap_hwmod *oh,
if (oh->class->name && strcmp(oh->class->name, data->name)) {
class = kmemdup(oh->class, sizeof(*oh->class), GFP_KERNEL);
if (!class)
- return -ENOMEM;
+ goto out_unmap;
}
if (list_empty(&oh->slave_ports)) {
oi = kcalloc(1, sizeof(*oi), GFP_KERNEL);
if (!oi)
- return -ENOMEM;
+ goto out_free_class;
/*
* Note that we assume interconnect interface clocks will be
@@ -3478,6 +3478,14 @@ static int omap_hwmod_allocate_module(struct device *dev, struct omap_hwmod *oh,
spin_unlock_irqrestore(&oh->_lock, flags);
return 0;
+
+out_free_class:
+ kfree(class);
+out_unmap:
+ iounmap();
+out_free_sysc:
+ kfree(sysc);
+ return -ENOMEM;
}
static const struct omap_hwmod_reset omap24xx_reset_quirks[] = {
--
2.22.0
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] ARM: OMAP2+: Fix possible memory leak in omap_hwmod_allocate_module
2020-06-19 10:42 ` Chen Tao
@ 2020-06-19 15:18 ` Paul Walmsley
-1 siblings, 0 replies; 6+ messages in thread
From: Paul Walmsley @ 2020-06-19 15:18 UTC (permalink / raw)
To: Chen Tao; +Cc: tony, linux, linux-omap, linux-arm-kernel, linux-kernel
On Fri, 19 Jun 2020, Chen Tao wrote:
> Fix memory leak in omap_hwmod_allocate_module not freeing in
> handling error path.
>
> Fixes: 8c87970543b17("ARM: OMAP2+: Add functions to allocate module data from device tree")
> Signed-off-by: Chen Tao <chentao107@huawei.com>
Reviewed-by: Paul Walmsley <paul@pwsan.com>
- Paul
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ARM: OMAP2+: Fix possible memory leak in omap_hwmod_allocate_module
@ 2020-06-19 15:18 ` Paul Walmsley
0 siblings, 0 replies; 6+ messages in thread
From: Paul Walmsley @ 2020-06-19 15:18 UTC (permalink / raw)
To: Chen Tao; +Cc: tony, linux-omap, linux, linux-arm-kernel, linux-kernel
On Fri, 19 Jun 2020, Chen Tao wrote:
> Fix memory leak in omap_hwmod_allocate_module not freeing in
> handling error path.
>
> Fixes: 8c87970543b17("ARM: OMAP2+: Add functions to allocate module data from device tree")
> Signed-off-by: Chen Tao <chentao107@huawei.com>
Reviewed-by: Paul Walmsley <paul@pwsan.com>
- Paul
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ARM: OMAP2+: Fix possible memory leak in omap_hwmod_allocate_module
2020-06-19 15:18 ` Paul Walmsley
@ 2020-07-13 16:47 ` Tony Lindgren
-1 siblings, 0 replies; 6+ messages in thread
From: Tony Lindgren @ 2020-07-13 16:47 UTC (permalink / raw)
To: Paul Walmsley; +Cc: Chen Tao, linux-omap, linux, linux-arm-kernel, linux-kernel
* Paul Walmsley <paul@pwsan.com> [200619 15:20]:
> On Fri, 19 Jun 2020, Chen Tao wrote:
>
> > Fix memory leak in omap_hwmod_allocate_module not freeing in
> > handling error path.
> >
> > Fixes: 8c87970543b17("ARM: OMAP2+: Add functions to allocate module data from device tree")
> > Signed-off-by: Chen Tao <chentao107@huawei.com>
>
> Reviewed-by: Paul Walmsley <paul@pwsan.com>
Thanks applying into fixes.
Tony
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] ARM: OMAP2+: Fix possible memory leak in omap_hwmod_allocate_module
@ 2020-07-13 16:47 ` Tony Lindgren
0 siblings, 0 replies; 6+ messages in thread
From: Tony Lindgren @ 2020-07-13 16:47 UTC (permalink / raw)
To: Paul Walmsley; +Cc: Chen Tao, linux-omap, linux, linux-arm-kernel, linux-kernel
* Paul Walmsley <paul@pwsan.com> [200619 15:20]:
> On Fri, 19 Jun 2020, Chen Tao wrote:
>
> > Fix memory leak in omap_hwmod_allocate_module not freeing in
> > handling error path.
> >
> > Fixes: 8c87970543b17("ARM: OMAP2+: Add functions to allocate module data from device tree")
> > Signed-off-by: Chen Tao <chentao107@huawei.com>
>
> Reviewed-by: Paul Walmsley <paul@pwsan.com>
Thanks applying into fixes.
Tony
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-07-13 16:49 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-19 10:42 [PATCH] ARM: OMAP2+: Fix possible memory leak in omap_hwmod_allocate_module Chen Tao
2020-06-19 10:42 ` Chen Tao
2020-06-19 15:18 ` Paul Walmsley
2020-06-19 15:18 ` Paul Walmsley
2020-07-13 16:47 ` Tony Lindgren
2020-07-13 16:47 ` Tony Lindgren
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.