Linux EXT4 FS development
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Edward AD <eadavis@sina.com>
Cc: syzbot+b3123e6d9842e526de39@syzkaller.appspotmail.com,
	adilger.kernel@dilger.ca, jack@suse.cz,
	linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org, llvm@lists.linux.dev,
	nathan@kernel.org, ndesaulniers@google.com,
	syzkaller-bugs@googlegroups.com, trix@redhat.com, tytso@mit.edu,
	yi.zhang@huawei.com
Subject: Re: [PATCH] ext4: fix ext4_calculate_overhead use invliad j_inode
Date: Mon, 28 Aug 2023 12:17:00 +0200	[thread overview]
Message-ID: <20230828101700.i3exsxt7bxz53kau@quack3> (raw)
In-Reply-To: <20230826035554.2849316-1-eadavis@sina.com>

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@syzkaller.appspotmail.com
> Fixes: 99d6c5d892bf ("ext4: ext4_get_{dev}_journal return proper error value")
> Signed-off-by: Edward AD <eadavis@sina.com>

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@huaweicloud.com


> ---
>  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@suse.com>
SUSE Labs, CR

      parent reply	other threads:[~2023-08-28 10:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-25  9:48 [syzbot] [ext4?] BUG: unable to handle kernel paging request in ext4_calculate_overhead syzbot
2023-08-25 12:22 ` Zhang Yi
     [not found] ` <20230826035554.2849316-1-eadavis@sina.com>
2023-08-28 10:17   ` Jan Kara [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230828101700.i3exsxt7bxz53kau@quack3 \
    --to=jack@suse.cz \
    --cc=adilger.kernel@dilger.ca \
    --cc=eadavis@sina.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=syzbot+b3123e6d9842e526de39@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=trix@redhat.com \
    --cc=tytso@mit.edu \
    --cc=yi.zhang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox