[GIT PULL] hfs/hfsplus changes for 6.19-rc1

From: Viacheslav Dubeyko

Date: Sun Nov 30 2025 - 22:36:15 EST


Hello Linus,

This pull request contains several fixes of syzbot reported
issues, HFS/HFS+ fixes of xfstests failures, Kunit-based unit-tests
introduction, and code cleanup.

Dan Carpenter has fixed the potential use-after-free issue
in hfs_correct_next_unused_CNID() method. Tetsuo Handa has made
nice fix of syzbot reported issue related to incorrect
inode->i_mode management if volume has been corrupted somehow.
Yang Chenzhi has made really good fix of potential race
condition in __hfs_bnode_create() method for HFS+ file system.

Several patches fix the xfstests failures. Particularly, generic/070,
generic/073, and generic/101 test-cases can be finished successfully
for the case of HFS+ file system right now.

HFS and HFS+ drivers share multiple structures of on-disk layout
declarations. Some structures are used without any change. However,
we had two independent declarations of the same structures in
HFS and HFS+ drivers. The on-disk layout declarations have been moved
into include/linux/hfs_common.h with the goal to exclude the
declarations duplication and to keep the HFS/HFS+ on-disk layout
declarations in one place. Also, this patch prepares
the basis for creating a hfslib that can aggregate common
functionality without necessity to duplicate the same code
in HFS and HFS+ drivers.

HFS/HFS+ really need unit-tests because of multiple xfstests
failures. The first two patches introduce Kunit-based unit-tests
for the case string operations in HFS/HFS+ file system drivers.

The following changes since commit
3a8660878839faadb4f1a6dd72c3179c1df56787:

Linux 6.18-rc1 (2025-10-12 13:42:36 -0700)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/vdubeyko/hfs.git
tags/hfs-v6.19-tag1

for you to fetch changes up to
ec95cd103c3a1e2567927014e4a710416cde3e52:

hfs/hfsplus: move on-disk layout declarations into hfs_common.h
(2025-11-25 15:16:03 -0800)

----------------------------------------------------------------
hfs/hfsplus updates for v6.19

- hfs/hfsplus: move on-disk layout declarations into hfs_common.h
- hfsplus: fix volume corruption issue for generic/101
- hfsplus: introduce KUnit tests for HFS+ string operations
- hfs: introduce KUnit tests for HFS string operations
- hfsplus: fix volume corruption issue for generic/073
- hfsplus: Verify inode mode when loading from disk
- hfsplus: fix volume corruption issue for generic/070
- hfs/hfsplus: prevent getting negative values of offset/length
- hfsplus: fix missing hfs_bnode_get() in __hfs_bnode_create
- hfs: fix potential use after free in hfs_correct_next_unused_CNID()

----------------------------------------------------------------
Dan Carpenter (1):
hfs: fix potential use after free in
hfs_correct_next_unused_CNID()

Tetsuo Handa (1):
hfsplus: Verify inode mode when loading from disk

Viacheslav Dubeyko (7):
hfs/hfsplus: prevent getting negative values of offset/length
hfsplus: fix volume corruption issue for generic/070
hfsplus: fix volume corruption issue for generic/073
hfs: introduce KUnit tests for HFS string operations
hfsplus: introduce KUnit tests for HFS+ string operations
hfsplus: fix volume corruption issue for generic/101
hfs/hfsplus: move on-disk layout declarations into hfs_common.h

Yang Chenzhi (1):
hfsplus: fix missing hfs_bnode_get() in __hfs_bnode_create

fs/hfs/.kunitconfig | 7 +
fs/hfs/Kconfig | 15 +
fs/hfs/Makefile | 2 +
fs/hfs/bfind.c | 2 +-
fs/hfs/bnode.c | 52 +-
fs/hfs/brec.c | 2 +-
fs/hfs/btree.c | 2 +-
fs/hfs/btree.h | 113 +---
fs/hfs/catalog.c | 2 +-
fs/hfs/hfs.h | 269 +-------
fs/hfs/hfs_fs.h | 89 +--
fs/hfs/inode.c | 3 +-
fs/hfs/string.c | 5 +
fs/hfs/string_test.c | 133 ++++
fs/hfsplus/.kunitconfig | 8 +
fs/hfsplus/Kconfig | 15 +
fs/hfsplus/Makefile | 3 +
fs/hfsplus/bfind.c | 2 +-
fs/hfsplus/bnode.c | 64 +-
fs/hfsplus/brec.c | 2 +-
fs/hfsplus/btree.c | 2 +-
fs/hfsplus/dir.c | 7 +-
fs/hfsplus/hfsplus_fs.h | 41 +-
fs/hfsplus/hfsplus_raw.h | 394 +----------
fs/hfsplus/inode.c | 41 +-
fs/hfsplus/super.c | 87 ++-
fs/hfsplus/unicode.c | 16 +-
fs/hfsplus/unicode_test.c | 1579
++++++++++++++++++++++++++++++++++++++++++++
fs/hfsplus/xattr.c | 22 +-
include/linux/hfs_common.h | 633 ++++++++++++++++++
30 files changed, 2698 insertions(+), 914 deletions(-)
create mode 100644 fs/hfs/.kunitconfig
create mode 100644 fs/hfs/string_test.c
create mode 100644 fs/hfsplus/.kunitconfig
create mode 100644 fs/hfsplus/unicode_test.c