lkml.org 
[lkml]   [2018]   [Sep]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH V2] mips: txx9: fix resource leak after register fail
From
Date

On 9/5/2018 11:37 PM, Atsushi Nemoto wrote:
> On Wed, 5 Sep 2018 19:22:19 +0800, Ding Xiang <dingxiang@cmss.chinamobile.com> wrote:
>> the memory allocated and ioremap address need free after
>> device_register return error.
> ...
>> exit_put:
>> put_device(&dev->dev);
>> - return;
>> +exit_free:
>> + iounmap(dev->base);
>> + kfree(dev);
> This change will break exit_put error path.
> I think kfree will be called from txx9_device_release by put_device.
>
> Please refer James's comment on previous trial:
> <https://www.linux-mips.org/cgi-bin/mesg.cgi?a=linux-mips&i=20180305221833.GJ4197%40saruman>

yes, put_device will call txx9_device_release and free txx9_sramc_dev,
and kfree in  sysfs_create_bin_file() error handle

is also unneeded, I will send a new patch soon



\
 
 \ /
  Last update: 2018-09-06 04:18    [W:0.529 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site