[PATCH v2 0/2] hfs: keep the internal B-tree inodes out of the VFS open path
From: 1sh1ro
Date: Mon Oct 12 2026 - 03:45:04 EST
Hi Viacheslav,
v2, following your suggestion. hfs_btree_open() no longer patches i_mode
up by hand: there is now an hfs_system_iget()/hfs_system_read_inode()
pair, the HFS counterpart of hfsplus_iget()/hfsplus_system_read_inode().
The B-tree inodes are created through the generic inode-cache path and
get their S_IFREG there, and the extent-record validation still runs
before hfs_btree_open() succeeds.
hfs_iget() itself is keyed on a catalog record (key + rec) and the
B-tree inodes have no catalog record, so hfs_system_iget() is a sibling
entry point sharing the same inode-cache path. Folding it into
hfs_iget() is a small change if you prefer that shape.
Patch 2 keeps the alias guard from v1 - a catalog record must not address
CNID 3/4 - as hardening on top of patch 1. Drop it if you consider
hfs_is_valid_cnid()'s acceptance of HFS_CDR_FIL records for those CNIDs
intentional.
The series applies to v7.3-rc5 and fs/hfs builds clean with clang.
Thanks,
1sh1ro
1sh1ro (2):
hfs: create the internal B-tree inodes through the generic iget path
hfs: refuse catalog records that address the reserved B-tree CNIDs
fs/hfs/btree.c | 25 +++++--------------------
fs/hfs/hfs_fs.h | 1 +
fs/hfs/inode.c | 85 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 91 insertions(+), 20 deletions(-)