Re: [PATCH -next] scsi: ufs: don't kfree() devm_kzalloc()'ed memory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxx>
> Cc: Vinayak Holikatti <vinholikatti@xxxxxxxxx>
> Cc: Dolev Raviv <draviv@xxxxxxxxxxxxxx>
> Cc: Subhash Jadavani <subhashj@xxxxxxxxxxxxxx>
> Cc: Yaniv Gardi <ygardi@xxxxxxxxxxxxxx>
> Cc: Sujit Reddy Thumma <sthumma@xxxxxxxxxxxxxx>
> Cc: Maya Erez <merez@xxxxxxxxxxxxxx>
> Cc: Sahitya Tummala <stummala@xxxxxxxxxxxxxx>
> Cc: Christoph Hellwig <hch@xxxxxx>
> Cc: "James E.J. Bottomley" <JBottomley@xxxxxxxxxxxxx>
> Cc: linux-scsi@xxxxxxxxxxxxxxx
> ---
>  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


--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux