From: George Anthony Vernon <contact@gvernon.com>
To: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
Cc: slava@dubeyko.com, glaubitz@physik.fu-berlin.de,
frank.li@vivo.com, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org,
syzbot+97e301b4b82ae803d21b@syzkaller.appspotmail.com
Subject: Re: [PATCH v4] hfs: Validate CNIDs in hfs_read_inode
Date: Wed, 18 Mar 2026 00:10:50 +0000 [thread overview]
Message-ID: <abntindMnlpodsNj@Bertha> (raw)
In-Reply-To: <93f202e6-81bc-4df7-b193-1a812094fa6f@I-love.SAKURA.ne.jp>
On Thu, Mar 12, 2026 at 07:45:17PM +0900, Tetsuo Handa wrote:
> Since is_valid_catalog_record() is called before inode->i_ino is assigned,
>
> + pr_warn("Invalid inode with cnid %lu\n", inode->i_ino);
>
> always prints 0.
>
Thank you, I will include a fix in the next patch version.
> kernel test robot <lkp@intel.com> reported that this patch needs below change.
>
> - if (!is_valid_catalog_record(rec->file.FlNum, rec->type))
> + if (!is_valid_catalog_record(be32_to_cpu(rec->file.FlNum), rec->type))
>
> - if (!is_valid_catalog_record(rec->dir.DirID, rec->type))
> + if (!is_valid_catalog_record(be32_to_cpu(rec->dir.DirID), rec->type))
>
> Because of this endian bug, syzbot did not test is_valid_catalog_record() == false case.
>
Sorry I don't follow this. How can you tell syzbot did not test the case?
> This patch also needs below change.
>
> - if (!root_inode || is_bad_inode(root_inode))
> + if (!root_inode)
> goto bail_no_root;
> + if (is_bad_inode(root_inode)) {
> + iput(root_inode);
> + goto bail_no_root;
> + }
>
> Since this bug is reported when "rmmod hfs" is done, syzbot would not be
> able to find this bug.
>
> And even after both changes are applied, my patch still makes sense
> because mount() operation still succeeds for cnid >= 16. :-)
I agree your patch fixes a real bug. I think Slava is suggesting a fix
to hfs_cat_find_brec() so that it validates the catalog records it
returns. Let's continue this discussion in reply to his email if that's
okay.
Thanks,
George
next prev parent reply other threads:[~2026-03-18 0:10 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-11 21:13 [PATCH v4] hfs: Validate CNIDs in hfs_read_inode George Anthony Vernon
2026-03-12 10:45 ` Tetsuo Handa
2026-03-12 23:13 ` Viacheslav Dubeyko
2026-03-13 11:03 ` Tetsuo Handa
2026-03-13 18:40 ` Viacheslav Dubeyko
2026-03-14 6:35 ` Tetsuo Handa
2026-03-16 21:50 ` Viacheslav Dubeyko
2026-03-18 0:37 ` George Anthony Vernon
2026-03-18 2:02 ` Viacheslav Dubeyko
2026-03-18 22:49 ` George Anthony Vernon
2026-03-19 9:57 ` Tetsuo Handa
2026-03-19 12:26 ` George Vernon
2026-03-20 0:32 ` Tetsuo Handa
2026-03-18 10:42 ` Tetsuo Handa
2026-03-18 0:10 ` George Anthony Vernon [this message]
2026-03-18 8:16 ` Tetsuo Handa
2026-03-12 23:07 ` Viacheslav Dubeyko
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=abntindMnlpodsNj@Bertha \
--to=contact@gvernon.com \
--cc=frank.li@vivo.com \
--cc=glaubitz@physik.fu-berlin.de \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=penguin-kernel@i-love.sakura.ne.jp \
--cc=slava@dubeyko.com \
--cc=syzbot+97e301b4b82ae803d21b@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