From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Akinobu Mita <akinobu.mita@gmail.com>
Cc: linux-scsi@vger.kernel.org, Akinobu Mita <mita@fixstars.com>,
Vinayak Holikatti <vinholikatti@gmail.com>,
Dolev Raviv <draviv@codeaurora.org>,
Subhash Jadavani <subhashj@codeaurora.org>,
Yaniv Gardi <ygardi@codeaurora.org>,
Sujit Reddy Thumma <sthumma@codeaurora.org>,
Maya Erez <merez@codeaurora.org>,
Sahitya Tummala <stummala@codeaurora.org>,
Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH -next] scsi: ufs: don't kfree() devm_kzalloc()'ed memory
Date: Wed, 26 Nov 2014 07:51:29 -0800 [thread overview]
Message-ID: <1417017089.2202.3.camel@HansenPartnership.com> (raw)
In-Reply-To: <1417016257-9693-1-git-send-email-akinobu.mita@gmail.com>
On Thu, 2014-11-27 at 00:37 +0900, Akinobu Mita wrote:
> In ufshcd_parse_clock_info(), temporary memory allocated by
> devm_kzalloc() is released by kfree(). The devres mechanism cannot
> track the release and it causes trouble when removing the driver.
>
> Fix it by allocating it with plain kcalloc() instead of devm_kzalloc()
> as the temporary memory is always freed in that function.
>
> Signed-off-by: Akinobu Mita <mita@fixstars.com>
> Cc: Vinayak Holikatti <vinholikatti@gmail.com>
> Cc: Dolev Raviv <draviv@codeaurora.org>
> Cc: Subhash Jadavani <subhashj@codeaurora.org>
> Cc: Yaniv Gardi <ygardi@codeaurora.org>
> Cc: Sujit Reddy Thumma <sthumma@codeaurora.org>
> Cc: Maya Erez <merez@codeaurora.org>
> Cc: Sahitya Tummala <stummala@codeaurora.org>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
> Cc: linux-scsi@vger.kernel.org
> ---
> drivers/scsi/ufs/ufshcd-pltfrm.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c
> index 0c030ad..67b1f6c 100644
> --- a/drivers/scsi/ufs/ufshcd-pltfrm.c
> +++ b/drivers/scsi/ufs/ufshcd-pltfrm.c
> @@ -99,8 +99,7 @@ static int ufshcd_parse_clock_info(struct ufs_hba *hba)
> goto out;
> }
>
> - clkfreq = devm_kzalloc(dev, sz * sizeof(*clkfreq),
> - GFP_KERNEL);
> + clkfreq = kcalloc(sz, sizeof(*clkfreq), GFP_KERNEL);
I agree this doesn't need to be devm memory since it's copied into clki,
but where is it freed? I think you need a kfree(clkfreq) at the bottom
of the routine.
James
next prev parent reply other threads:[~2014-11-26 15:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-26 15:37 [PATCH -next] scsi: ufs: don't kfree() devm_kzalloc()'ed memory Akinobu Mita
2014-11-26 15:51 ` James Bottomley [this message]
2014-11-26 16:11 ` Akinobu Mita
2014-11-26 16:14 ` James Bottomley
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=1417017089.2202.3.camel@HansenPartnership.com \
--to=james.bottomley@hansenpartnership.com \
--cc=akinobu.mita@gmail.com \
--cc=draviv@codeaurora.org \
--cc=hch@lst.de \
--cc=linux-scsi@vger.kernel.org \
--cc=merez@codeaurora.org \
--cc=mita@fixstars.com \
--cc=sthumma@codeaurora.org \
--cc=stummala@codeaurora.org \
--cc=subhashj@codeaurora.org \
--cc=vinholikatti@gmail.com \
--cc=ygardi@codeaurora.org \
/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 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.