lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <85475b50-5617-1ed0-3fe6-3dbaa18c236c@linaro.org>
Date:   Fri, 20 Dec 2019 10:58:36 +0100
From:   Daniel Lezcano <daniel.lezcano@...aro.org>
To:     Colin King <colin.king@...onical.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Nicolas Saenz Julienne <nsaenzjulienne@...e.de>,
        Florian Fainelli <f.fainelli@...il.com>,
        Ray Jui <rjui@...adcom.com>,
        Scott Branden <sbranden@...adcom.com>,
        bcm-kernel-feedback-list@...adcom.com,
        linux-kernel@...r.kernel.org, linux-rpi-kernel@...ts.infradead.org
Cc:     kernel-janitors@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH] clocksource/drivers/bcm2835_timer: fix memory leak of
 timer


Applied, thanks!

On 19/12/2019 22:32, Colin King wrote:
> From: Colin Ian King <colin.king@...onical.com>
> 
> Currently when setup_irq fails the error exit path will leak the
> recently allocated timer structure.  Originally the code would
> throw a panic but a later commit changed the behaviour to return
> via the err_iounmap path and hence we now have a memory leak. Fix
> this by adding a err_timer_free error path that kfree's timer.
> 
> Addresses-Coverity: ("Resource Leak")
> Fixes: 524a7f08983d ("clocksource/drivers/bcm2835_timer: Convert init function to return error")
> Signed-off-by: Colin Ian King <colin.king@...onical.com>
> ---
>  drivers/clocksource/bcm2835_timer.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/clocksource/bcm2835_timer.c b/drivers/clocksource/bcm2835_timer.c
> index 2b196cbfadb6..b235f446ee50 100644
> --- a/drivers/clocksource/bcm2835_timer.c
> +++ b/drivers/clocksource/bcm2835_timer.c
> @@ -121,7 +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");
> -		goto err_iounmap;
> +		goto err_timer_free;
>  	}
>  
>  	clockevents_config_and_register(&timer->evt, freq, 0xf, 0xffffffff);
> @@ -130,6 +130,9 @@ static int __init bcm2835_timer_init(struct device_node *node)
>  
>  	return 0;
>  
> +err_timer_free:
> +	kfree(timer);
> +
>  err_iounmap:
>  	iounmap(base);
>  	return ret;
> 


-- 
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ