Re: [PATCH] ext4: fix ext4_calculate_overhead use invliad j_inode

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

 



On Sat 26-08-23 11:55:54, Edward AD wrote:
> In ext4_calculate_overhead(), ext4_get_journal_inode() returned an invalid inode 
> pointer without processing. Here, an invalid pointer judgment condition is added 
> to avoid incorrect operation of invalid pointer j_inode.
> 
> Reported-by: syzbot+b3123e6d9842e526de39@xxxxxxxxxxxxxxxxxxxxxxxxx
> Fixes: 99d6c5d892bf ("ext4: ext4_get_{dev}_journal return proper error value")
> Signed-off-by: Edward AD <eadavis@xxxxxxxx>

Thanks for the fixup but Ted has already merged the fixup from Zhang Yi [1].

								Honza

[1] https://lore.kernel.org/all/20230826011029.2023140-1-yi.zhang@xxxxxxxxxxxxxxx


> ---
>  fs/ext4/super.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 34f5406c08da..0dac00954d25 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -4178,7 +4178,7 @@ int ext4_calculate_overhead(struct super_block *sb)
>  	else if (ext4_has_feature_journal(sb) && !sbi->s_journal && j_inum) {
>  		/* j_inum for internal journal is non-zero */
>  		j_inode = ext4_get_journal_inode(sb, j_inum);
> -		if (j_inode) {
> +		if (j_inode && !IS_ERR(j_inode)) {
>  			j_blocks = j_inode->i_size >> sb->s_blocksize_bits;
>  			overhead += EXT4_NUM_B2C(sbi, j_blocks);
>  			iput(j_inode);
> -- 
> 2.25.1
> 
-- 
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux