From: Heming Zhao <heming.zhao@suse.com>
To: Dmitry Antipov <dmantipov@yandex.ru>
Cc: Joseph Qi <joseph.qi@linux.alibaba.com>,
Joel Becker <jlbec@evilplan.org>, Mark Fasheh <mark@fasheh.com>,
ocfs2-devel@lists.linux.dev, lvc-project@linuxtesting.org,
syzbot+5bdd4953bc58c8fbd6eb@syzkaller.appspotmail.com
Subject: Re: [PATCH] ocfs2: reject orphaned dinodes with non-zero link count
Date: Fri, 5 Jun 2026 09:49:40 +0800 [thread overview]
Message-ID: <aiInqlRZmftnaPVX@p15> (raw)
In-Reply-To: <20260604115919.536337-1-dmantipov@yandex.ru>
On Thu, Jun 04, 2026 at 02:59:19PM +0300, Dmitry Antipov wrote:
> Since non-zero link count for an orphaned inode most likely
> means that on-disk inode data is corrupted, reject such an
> inodes in 'ocfs2_validate_inode_block()'.
IIUC, If a file has hard links, its link count will be greater than 1. If the
file size is extended, this inode will be marked as orphaned, while the link
count remains the same as before.
Thanks,
Heming
>
> Reported-by: syzbot+5bdd4953bc58c8fbd6eb@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=5bdd4953bc58c8fbd6eb
> Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
> ---
> I'm quite sure about Closes: but was unable to test this using syzbot due to
> "FATAL: kernel too old" issues (most likely caused by the kernel vs. glibc
> mismatch) like https://syzkaller.appspot.com/x/log.txt?x=13f51bec580000.
> ---
> fs/ocfs2/inode.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c
> index a510a0eb1adc..d483e0c61d12 100644
> --- a/fs/ocfs2/inode.c
> +++ b/fs/ocfs2/inode.c
> @@ -1477,6 +1477,15 @@ int ocfs2_validate_inode_block(struct super_block *sb,
> goto bail;
> }
>
> + if ((le32_to_cpu(di->i_flags) & OCFS2_ORPHANED_FL) &&
> + ocfs2_read_links_count(di)) {
> + rc = ocfs2_error(sb,
> + "Invalid dinode #%llu: orphaned with %u links\n",
> + (unsigned long long)bh->b_blocknr,
> + ocfs2_read_links_count(di));
> + goto bail;
> + }
> +
> if (le32_to_cpu(di->i_fs_generation) !=
> OCFS2_SB(sb)->fs_generation) {
> rc = ocfs2_error(sb,
> --
> 2.54.0
>
>
prev parent reply other threads:[~2026-06-05 1:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-04 11:59 [PATCH] ocfs2: reject orphaned dinodes with non-zero link count Dmitry Antipov
2026-06-05 1:49 ` Heming Zhao [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=aiInqlRZmftnaPVX@p15 \
--to=heming.zhao@suse.com \
--cc=dmantipov@yandex.ru \
--cc=jlbec@evilplan.org \
--cc=joseph.qi@linux.alibaba.com \
--cc=lvc-project@linuxtesting.org \
--cc=mark@fasheh.com \
--cc=ocfs2-devel@lists.linux.dev \
--cc=syzbot+5bdd4953bc58c8fbd6eb@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.