lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 20 Nov 2022 11:11:48 +0800
From:   Qu Wenruo <quwenruo.btrfs@....com>
To:     Zhen Lei <thunder.leizhen@...wei.com>, Chris Mason <clm@...com>,
        Josef Bacik <josef@...icpanda.com>,
        David Sterba <dsterba@...e.com>, linux-btrfs@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] btrfs: fix a resource leak in btrfs_init_sysfs()



On 2022/11/19 14:53, Qu Wenruo wrote:
> 
> 
> On 2022/11/19 14:43, Zhen Lei wrote:
>> When btrfs_debug_feature_attr_group fails to be created,
>> btrfs_feature_attr_group is not removed.
>>
>> Signed-off-by: Zhen Lei <thunder.leizhen@...wei.com>
> 
> Reviewed-by: Qu Wenruo <wqu@...e.com>

Wait for a minute, should we call sysfs_unmerge_group() first before 
calling sysfs_remove_group()?

As the sysfs_remove_group() will only remove the 
btrfs_feature_attr_group, and kset_unregister() will only free 
btrfs_kset, without removing the added btrfs_static_feature_attr_group.

I haven't yet find a function that will remove all children attrs in 
just one go, or did I miss something?

Thanks,
Qu
> 
> Thanks,
> Qu
>> ---
>>   fs/btrfs/sysfs.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
>> index 699b54b3acaae0b..947125f2ceaaf96 100644
>> --- a/fs/btrfs/sysfs.c
>> +++ b/fs/btrfs/sysfs.c
>> @@ -2322,7 +2322,7 @@ int __init btrfs_init_sysfs(void)
>>   #ifdef CONFIG_BTRFS_DEBUG
>>       ret = sysfs_create_group(&btrfs_kset->kobj, 
>> &btrfs_debug_feature_attr_group);
>>       if (ret)
>> -        goto out2;
>> +        goto out_remove_group;
>>   #endif
>>       return 0;

Powered by blists - more mailing lists