All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] locking/atomics: Fix memory leak in bcm2835_timer_init
@ 2019-10-21 20:13 ` Navid Emamdoost
  0 siblings, 0 replies; 4+ messages in thread
From: Navid Emamdoost @ 2019-10-21 20:13 UTC (permalink / raw)
  Cc: emamd001, kjlu, smccaman, Navid Emamdoost, Daniel Lezcano,
	Thomas Gleixner, Florian Fainelli, Ray Jui, Scott Branden,
	bcm-kernel-feedback-list, Eric Anholt, Stefan Wahren,
	linux-kernel, linux-rpi-kernel, linux-arm-kernel

In the impelementation of bcm2835_timer_init() the allocated memory for
timer should be released if setup_irq() fails.

Fixes: 84c39b8b7d46 ("clocksource/drivers/bcm2835_timer: Unmap region obtained by of_iomap")
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
 drivers/clocksource/bcm2835_timer.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clocksource/bcm2835_timer.c b/drivers/clocksource/bcm2835_timer.c
index 2b196cbfadb6..7b27cc53ce9c 100644
--- a/drivers/clocksource/bcm2835_timer.c
+++ b/drivers/clocksource/bcm2835_timer.c
@@ -121,6 +121,7 @@ static int __init bcm2835_timer_init(struct device_node *node)
 	ret = setup_irq(irq, &timer->act);
 	if (ret) {
 		pr_err("Can't set up timer IRQ\n");
+		kfree(timer);
 		goto err_iounmap;
 	}
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] locking/atomics: Fix memory leak in bcm2835_timer_init
@ 2019-10-21 20:13 ` Navid Emamdoost
  0 siblings, 0 replies; 4+ messages in thread
From: Navid Emamdoost @ 2019-10-21 20:13 UTC (permalink / raw)
  Cc: linux-rpi-kernel, Florian Fainelli, Scott Branden, Ray Jui,
	Daniel Lezcano, kjlu, linux-kernel, Eric Anholt, emamd001,
	bcm-kernel-feedback-list, Stefan Wahren, smccaman,
	Thomas Gleixner, linux-arm-kernel, Navid Emamdoost

In the impelementation of bcm2835_timer_init() the allocated memory for
timer should be released if setup_irq() fails.

Fixes: 84c39b8b7d46 ("clocksource/drivers/bcm2835_timer: Unmap region obtained by of_iomap")
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
 drivers/clocksource/bcm2835_timer.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/clocksource/bcm2835_timer.c b/drivers/clocksource/bcm2835_timer.c
index 2b196cbfadb6..7b27cc53ce9c 100644
--- a/drivers/clocksource/bcm2835_timer.c
+++ b/drivers/clocksource/bcm2835_timer.c
@@ -121,6 +121,7 @@ static int __init bcm2835_timer_init(struct device_node *node)
 	ret = setup_irq(irq, &timer->act);
 	if (ret) {
 		pr_err("Can't set up timer IRQ\n");
+		kfree(timer);
 		goto err_iounmap;
 	}
 
-- 
2.17.1


_______________________________________________
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] 4+ messages in thread

* Re: [PATCH] locking/atomics: Fix memory leak in bcm2835_timer_init
  2019-10-21 20:13 ` Navid Emamdoost
@ 2019-10-21 20:46   ` Florian Fainelli
  -1 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2019-10-21 20:46 UTC (permalink / raw)
  To: Navid Emamdoost
  Cc: emamd001, kjlu, smccaman, Daniel Lezcano, Thomas Gleixner,
	Ray Jui, Scott Branden, bcm-kernel-feedback-list, Eric Anholt,
	Stefan Wahren, linux-kernel, linux-rpi-kernel, linux-arm-kernel

On 10/21/19 1:13 PM, Navid Emamdoost wrote:
> In the impelementation of bcm2835_timer_init() the allocated memory for
> timer should be released if setup_irq() fails.

s/impelementation/implementation/ and also the subject should probably
be changed to better reflect the scope of the patch. With that:

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>

> 
> Fixes: 84c39b8b7d46 ("clocksource/drivers/bcm2835_timer: Unmap region obtained by of_iomap")
> Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
> ---
>  drivers/clocksource/bcm2835_timer.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/clocksource/bcm2835_timer.c b/drivers/clocksource/bcm2835_timer.c
> index 2b196cbfadb6..7b27cc53ce9c 100644
> --- a/drivers/clocksource/bcm2835_timer.c
> +++ b/drivers/clocksource/bcm2835_timer.c
> @@ -121,6 +121,7 @@ static int __init bcm2835_timer_init(struct device_node *node)
>  	ret = setup_irq(irq, &timer->act);
>  	if (ret) {
>  		pr_err("Can't set up timer IRQ\n");
> +		kfree(timer);
>  		goto err_iounmap;
>  	}
>  
> 


-- 
Florian

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] locking/atomics: Fix memory leak in bcm2835_timer_init
@ 2019-10-21 20:46   ` Florian Fainelli
  0 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2019-10-21 20:46 UTC (permalink / raw)
  To: Navid Emamdoost
  Cc: Scott Branden, Ray Jui, Daniel Lezcano, kjlu, linux-kernel,
	Eric Anholt, emamd001, bcm-kernel-feedback-list, Stefan Wahren,
	smccaman, Thomas Gleixner, linux-arm-kernel, linux-rpi-kernel

On 10/21/19 1:13 PM, Navid Emamdoost wrote:
> In the impelementation of bcm2835_timer_init() the allocated memory for
> timer should be released if setup_irq() fails.

s/impelementation/implementation/ and also the subject should probably
be changed to better reflect the scope of the patch. With that:

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>

> 
> Fixes: 84c39b8b7d46 ("clocksource/drivers/bcm2835_timer: Unmap region obtained by of_iomap")
> Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
> ---
>  drivers/clocksource/bcm2835_timer.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/clocksource/bcm2835_timer.c b/drivers/clocksource/bcm2835_timer.c
> index 2b196cbfadb6..7b27cc53ce9c 100644
> --- a/drivers/clocksource/bcm2835_timer.c
> +++ b/drivers/clocksource/bcm2835_timer.c
> @@ -121,6 +121,7 @@ static int __init bcm2835_timer_init(struct device_node *node)
>  	ret = setup_irq(irq, &timer->act);
>  	if (ret) {
>  		pr_err("Can't set up timer IRQ\n");
> +		kfree(timer);
>  		goto err_iounmap;
>  	}
>  
> 


-- 
Florian

_______________________________________________
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] 4+ messages in thread

end of thread, other threads:[~2019-10-21 20:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-21 20:13 [PATCH] locking/atomics: Fix memory leak in bcm2835_timer_init Navid Emamdoost
2019-10-21 20:13 ` Navid Emamdoost
2019-10-21 20:46 ` Florian Fainelli
2019-10-21 20:46   ` Florian Fainelli

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.