linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@kernel.org>
To: Colin King <colin.king@canonical.com>,
	Eric Anholt <eric@anholt.net>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Michael Turquette <mturquette@baylibre.com>,
	Ray Jui <rjui@broadcom.com>,
	Scott Branden <sbranden@broadcom.com>,
	Stefan Wahren <stefan.wahren@i2se.com>,
	bcm-kernel-feedback-list@broadcom.com,
	linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org,
	linux-rpi-kernel@lists.infradead.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH][next] clk: bcm2835: fix memork leak on unfree'd pll struct
Date: Fri, 07 Jun 2019 12:03:30 -0700	[thread overview]
Message-ID: <20190607190331.8B06020868@mail.kernel.org> (raw)
In-Reply-To: <20190607104533.14700-1-colin.king@canonical.com>

Quoting Colin King (2019-06-07 03:45:33)
> From: Colin Ian King <colin.king@canonical.com>
> 
> The pll struct is being allocated but not kfree'd on an error return
> path when devm_clk_hw_register fails.  Fix this with a kfree on pll
> if an error occurs.
> 
> Addresses-Coverity: ("Resource leak")
> Fixes: b19f009d4510 ("clk: bcm2835: Migrate to clk_hw based registration and OF APIs")

I suspect this problem was there before this commit, but OK.

> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  drivers/clk/bcm/clk-bcm2835.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/bcm/clk-bcm2835.c b/drivers/clk/bcm/clk-bcm2835.c
> index 770bb01f523e..90584deaf416 100644
> --- a/drivers/clk/bcm/clk-bcm2835.c
> +++ b/drivers/clk/bcm/clk-bcm2835.c
> @@ -1310,8 +1310,10 @@ static struct clk_hw *bcm2835_register_pll(struct bcm2835_cprman *cprman,
>         pll->hw.init = &init;
>  
>         ret = devm_clk_hw_register(cprman->dev, &pll->hw);
> -       if (ret)
> +       if (ret) {
> +               kfree(pll);
>                 return NULL;
> +       }
>         return &pll->hw;
>  }

Aren't there more leaks in this driver? 


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2019-06-07 19:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-07 10:45 [PATCH][next] clk: bcm2835: fix memork leak on unfree'd pll struct Colin King
2019-06-07 19:03 ` Stephen Boyd [this message]
2019-06-08 22:23   ` Colin Ian King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190607190331.8B06020868@mail.kernel.org \
    --to=sboyd@kernel.org \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=colin.king@canonical.com \
    --cc=eric@anholt.net \
    --cc=f.fainelli@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=mturquette@baylibre.com \
    --cc=rjui@broadcom.com \
    --cc=sbranden@broadcom.com \
    --cc=stefan.wahren@i2se.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).