From: Joseph Qi <joseph.qi@linux.alibaba.com>
To: Deepanshu Kartikey <kartikey406@gmail.com>,
mark@fasheh.com, jlbec@evilplan.org, heming.zhao@suse.com
Cc: ocfs2-devel@lists.linux.dev, linux-kernel@vger.kernel.org,
syzbot+6d832e79d3efe1c46743@syzkaller.appspotmail.com
Subject: Re: [PATCH v2] ocfs2: validate i_refcount_loc when refcount flag is set
Date: Fri, 12 Dec 2025 13:48:19 +0800 [thread overview]
Message-ID: <5c47b8a5-f9fa-45b1-9966-442a45a4e3b6@linux.alibaba.com> (raw)
In-Reply-To: <20251212045646.9988-1-kartikey406@gmail.com>
On 2025/12/12 12:56, Deepanshu Kartikey wrote:
> Add validation in ocfs2_validate_inode_block() to check that if an
> inode has OCFS2_HAS_REFCOUNT_FL set, it must also have a valid
> i_refcount_loc. A corrupted filesystem image can have this inconsistent
> state, which later triggers a BUG_ON in ocfs2_remove_refcount_tree()
> when the inode is being wiped during unlink.
>
> Catch this corruption early during inode validation to fail gracefully
> instead of crashing the kernel.
>
> Reported-by: syzbot+6d832e79d3efe1c46743@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=6d832e79d3efe1c46743
> Tested-by: syzbot+6d832e79d3efe1c46743@syzkaller.appspotmail.com
> Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com>
> ---
> v2: Shortened error message to fix line length (Heming Zhao)
> ---
> fs/ocfs2/inode.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
> index 78f81950c9ee..06f1f9e21423 100644
> --- a/fs/ocfs2/inode.c
> +++ b/fs/ocfs2/inode.c
> @@ -1484,6 +1484,13 @@ int ocfs2_validate_inode_block(struct super_block *sb,
> goto bail;
> }
>
> + if ((di->i_dyn_features & cpu_to_le16(OCFS2_HAS_REFCOUNT_FL)) &&
I'd like to covert it to host endian to keep consistent with other checks.
Thanks,
Joseph
> + !di->i_refcount_loc) {
> + rc = ocfs2_error(sb, "Inode #%llu has refcount flag but no i_refcount_loc\n",
> + (unsigned long long)bh->b_blocknr);
> + goto bail;
> + }
> +
> rc = 0;
>
> bail:
prev parent reply other threads:[~2025-12-12 5:48 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-12 4:56 Deepanshu Kartikey
2025-12-12 5:48 ` Joseph Qi [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=5c47b8a5-f9fa-45b1-9966-442a45a4e3b6@linux.alibaba.com \
--to=joseph.qi@linux.alibaba.com \
--cc=heming.zhao@suse.com \
--cc=jlbec@evilplan.org \
--cc=kartikey406@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark@fasheh.com \
--cc=ocfs2-devel@lists.linux.dev \
--cc=syzbot+6d832e79d3efe1c46743@syzkaller.appspotmail.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
all inboxes | Powered by JetHome®