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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cc17bad2-ef56-40bc-9fae-073c1065a57b@gmail.com>
Date: Wed, 3 Dec 2025 11:08:10 -0500
From: Vivek BalachandharTN <vivek.balachandhar@...il.com>
To: Jan Kara <jack@...e.cz>
Cc: jack@...e.com, linux-ext4@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] ext2: factor out ext2_fill_super() teardown path

thanks for the review. You are right — the helper has only one call site 
and bh is uninitialized on some failed_sbi paths. I will drop this patch 
and look for a more meaningful cleanup in ext2.

Vivek

On 2025-12-03 5:40 a.m., Jan Kara wrote:
> On Wed 03-12-25 04:50:48, Vivek BalachandharTN wrote:
>> The error path at the end of ext2_fill_super() open-codes the final
>> teardown of the ext2_sb_info structure and associated resources.
>> Centralize this into a small helper to make the control flow a bit
>> clearer and avoid repeating the same cleanup sequence in multiple
>> labels.
>>
>> Behavior is unchanged.
>>
>> Signed-off-by: Vivek BalachandharTN <vivek.balachandhar@...il.com>
> This is pointless - no point in factoring out helper when it has a single
> call site. Also your patch is broken in several ways (both in correctness
> and style). Please be more thoughtful when submitting patches.
>
> 								Honza
>
>> +static void ext2_free_sbi(struct super_block *sb,
>> +			  struct ext2_sb_info *sbi,
>> +			  struct buffer_head *bh)
>> +{
>> +	if (bh)
>> +		brelse(bh);
>> +
>> +	fs_put_dax(sbi->s_daxdev, NULL);
>> +	sb->s_fs_info = NULL;
>> +	kfree(sbi->s_blockgroup_lock);
>> +	kfree(sbi);
>> +}
>> +
>>   static int ext2_fill_super(struct super_block *sb, struct fs_context *fc)
>>   {
>>   	struct ext2_fs_context *ctx = fc->fs_private;
>> @@ -1251,12 +1264,8 @@ static int ext2_fill_super(struct super_block *sb, struct fs_context *fc)
>>   	kvfree(sbi->s_group_desc);
>>   	kfree(sbi->s_debts);
>>   failed_mount:
>> -	brelse(bh);
>>   failed_sbi:
>> -	fs_put_dax(sbi->s_daxdev, NULL);
>> -	sb->s_fs_info = NULL;
>> -	kfree(sbi->s_blockgroup_lock);
>> -	kfree(sbi);
>> +	ext2_free_sbi(sb, sbi, bh);
>>   	return ret;
>>   }
>>   
>> -- 
>> 2.34.1
>>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ