Forwarded: Re: [syzbot] KMSAN: uninit-value in hfsplus_cat_read_inode

From: syzbot

Date: Fri Apr 17 2026 - 12:23:48 EST


For archival purposes, forwarding an incoming command email to
linux-kernel@xxxxxxxxxxxxxxx, syzkaller-bugs@xxxxxxxxxxxxxxxx.

***

Subject: Re: [syzbot] KMSAN: uninit-value in hfsplus_cat_read_inode
Author: tristmd@xxxxxxxxx

#syz test: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>From c548b434d782cb365bfeae52c7278548b16d6e85 Mon Sep 17 00:00:00 2001
From: Tristan Madani <tristan@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 17 Apr 2026 16:15:17 +0000
Subject: [PATCH] hfsplus: initialize subfolders field when HAS_FOLDER_COUNT is
not set
hfsplus_cat_read_inode() only initializes the subfolders field when
the HFSPLUS_HAS_FOLDER_COUNT flag is set. When it is not set, the
field retains stale data from previous use, which KMSAN detects as
uninit-value during rename operations.
Add an else branch to zero-initialize subfolders when the flag is
not set.
Reported-by: syzbot+93f4402297a457fc6895@xxxxxxxxxxxxxxxxxxxxxxxxx
Closes: https://syzkaller.appspot.com/bug?extid=93f4402297a457fc6895
Signed-off-by: Tristan Madani <tristan@xxxxxxxxxxxxxxxxxxx>
---
fs/hfsplus/inode.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c
index d05891e..356847a 100644
--- a/fs/hfsplus/inode.c
+++ b/fs/hfsplus/inode.c
@@ -592,6 +592,8 @@ int hfsplus_cat_read_inode(struct inode *inode, struct hfs_find_data *fd)
if (folder->flags & cpu_to_be16(HFSPLUS_HAS_FOLDER_COUNT)) {
HFSPLUS_I(inode)->subfolders =
be32_to_cpu(folder->subfolders);
+ } else {
+ HFSPLUS_I(inode)->subfolders = 0;
}
inode->i_op = &hfsplus_dir_inode_operations;
inode->i_fop = &hfsplus_dir_operations;
--
2.47.3