From: syzbot <syzbot+c0ba772a362e70937dfb@syzkaller.appspotmail.com>
To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Forwarded: [PATCH] hfsplus: fix null-ptr-deref in hfsplus_cat_write_inode
Date: Tue, 14 Apr 2026 16:36:26 -0700 [thread overview]
Message-ID: <69decf7a.a00a0220.475f0.0046.GAE@google.com> (raw)
In-Reply-To: <69dd652c.a00a0220.475f0.002d.GAE@google.com>
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com.
***
Subject: [PATCH] hfsplus: fix null-ptr-deref in hfsplus_cat_write_inode
Author: kartikey406@gmail.com
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
When a corrupt HFS+ image is mounted where the hidden directory is
absent, hfsplus_fill_super() handles -ENOENT from
hfsplus_get_hidden_dir_entry() silently and continues with
sbi->hidden_dir left as NULL.
hfsplus_link() and hfsplus_unlink() call
hfsplus_cat_write_inode(sbi->hidden_dir) unconditionally without
checking whether hidden_dir is NULL, triggering a general protection
fault caught by KASAN as a null-ptr-deref at offset 0x28.
Other call sites in dir.c already guard against this by checking
hidden_dir for NULL before use. Apply the same guard to the two
unprotected call sites in hfsplus_link() and hfsplus_unlink().
Reported-by: syzbot+c0ba772a362e70937dfb@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=c0ba772a362e70937dfb
Signed-off-by: Deepanshu Kartikey <kartikey406@gmail.com>
---
fs/hfsplus/dir.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/fs/hfsplus/dir.c b/fs/hfsplus/dir.c
index d559bf8625f8..a7feef53d8cb 100644
--- a/fs/hfsplus/dir.c
+++ b/fs/hfsplus/dir.c
@@ -362,9 +362,11 @@ static int hfsplus_link(struct dentry *src_dentry, struct inode *dst_dir,
if (res)
goto out;
- res = hfsplus_cat_write_inode(sbi->hidden_dir);
- if (res)
- goto out;
+ if (sbi->hidden_dir) {
+ res = hfsplus_cat_write_inode(sbi->hidden_dir);
+ if (res)
+ goto out;
+ }
res = hfsplus_cat_write_inode(inode);
@@ -431,11 +433,10 @@ static int hfsplus_unlink(struct inode *dir, struct dentry *dentry)
out:
if (!res) {
res = hfsplus_cat_write_inode(dir);
- if (!res) {
+ if (!res && sbi->hidden_dir)
res = hfsplus_cat_write_inode(sbi->hidden_dir);
- if (!res)
- res = hfsplus_cat_write_inode(inode);
- }
+ if (!res)
+ res = hfsplus_cat_write_inode(inode);
}
mutex_unlock(&sbi->vh_mutex);
--
2.43.0
prev parent reply other threads:[~2026-04-14 23:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-13 21:50 [syzbot] [hfs?] general protection fault in hfsplus_cat_write_inode syzbot
2026-04-13 23:02 ` Forwarded: [PATCH] hfsplus: fix ignored error return in hfsplus_delete_cat syzbot
2026-04-14 23:36 ` syzbot [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=69decf7a.a00a0220.475f0.0046.GAE@google.com \
--to=syzbot+c0ba772a362e70937dfb@syzkaller.appspotmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=syzkaller-bugs@googlegroups.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