[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMpxmJVC5GGhR0z_4CkF7Opfw-5HpEKD8fUrKsgBZTbz0wDd-Q@mail.gmail.com>
Date: Sun, 10 Nov 2019 16:59:49 +0100
From: Bartosz Golaszewski <bgolaszewski@...libre.com>
To: Daniel Lezcano <daniel.lezcano@...aro.org>
Cc: Colin King <colin.king@...onical.com>,
Thomas Gleixner <tglx@...utronix.de>,
LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] clocksource/drivers/davinci: fix memory leak on
clockevent on error return
sob., 9 lis 2019 o 16:58 Colin King <colin.king@...onical.com> napisaĆ(a):
>
> From: Colin Ian King <colin.king@...onical.com>
>
> In the case where request_irq fails, the return path does not kfree
> clockevent and hence we have a memory leak. Fix this by kfree'ing
> clockevent before returning.
>
> Addresses-Coverity: ("Resource leak")
> Fixes: 721154f972aa ("clocksource/drivers/davinci: Add support for clockevents")
> Signed-off-by: Colin Ian King <colin.king@...onical.com>
> ---
> drivers/clocksource/timer-davinci.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/clocksource/timer-davinci.c b/drivers/clocksource/timer-davinci.c
> index 62745c962049..910d4d2f0d64 100644
> --- a/drivers/clocksource/timer-davinci.c
> +++ b/drivers/clocksource/timer-davinci.c
> @@ -299,6 +299,7 @@ int __init davinci_timer_register(struct clk *clk,
> "clockevent/tim12", clockevent);
> if (rv) {
> pr_err("Unable to request the clockevent interrupt");
> + kfree(clockevent);
> return rv;
> }
>
> --
> 2.20.1
>
Hi Daniel,
this is what I think the third time someone tries to "fix" this
driver's "memory leaks". I'm not sure what the general approach in
clocksource is but it doesn't make sense to free resources on
non-recoverable errors, does it? Should I add a comment about it or
you'll just take those "fixes" to stop further such submissions?
Best regards,
Bartosz Golaszewski
Powered by blists - more mailing lists