From: Tristan Madani <tristmd@gmail.com>
To: Viacheslav Dubeyko <slava@dubeyko.com>,
John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>,
Yangtao Li <frank.li@vivo.com>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org,
Tristan Madani <tristan@talencesecurity.com>,
syzbot+bc70a12e438dadba4fb4@syzkaller.appspotmail.com
Subject: [PATCH 3/3] hfsplus: fix null pointer dereference in hfsplus_create_attributes_file
Date: Fri, 1 May 2026 11:02:17 +0000 [thread overview]
Message-ID: <20260501110218.29906-3-tristmd@gmail.com> (raw)
In-Reply-To: <20260501110218.29906-1-tristmd@gmail.com>
From: Tristan Madani <tristan@talencesecurity.com>
hfsplus_create_attributes_file() calls hfsplus_mark_inode_dirty() with
HFSPLUS_ATTR_TREE_I(sb) before sbi->attr_tree has been set by
hfs_btree_open(). HFSPLUS_ATTR_TREE_I dereferences sbi->attr_tree to
reach ->inode, causing a null pointer dereference when attr_tree is
still NULL.
Move the mark_dirty call to after hfs_btree_open() and guard it with a
NULL check on sbi->attr_tree.
Reported-by: syzbot+bc70a12e438dadba4fb4@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=bc70a12e438dadba4fb4
Tested-by: syzbot+bc70a12e438dadba4fb4@syzkaller.appspotmail.com
Fixes: ee8422d00b7c ("hfsplus: fix potential Allocation File corruption after fsync")
Cc: stable@vger.kernel.org
Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
---
fs/hfsplus/xattr.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/hfsplus/xattr.c b/fs/hfsplus/xattr.c
index 452a1f9becb2d..1ea9f313368c5 100644
--- a/fs/hfsplus/xattr.c
+++ b/fs/hfsplus/xattr.c
@@ -317,12 +317,13 @@ static int hfsplus_create_attributes_file(struct super_block *sb)
next_node++;
}
- hfsplus_mark_inode_dirty(HFSPLUS_ATTR_TREE_I(sb), HFSPLUS_I_ATTR_DIRTY);
hfsplus_mark_inode_dirty(attr_file, HFSPLUS_I_ATTR_DIRTY);
sbi->attr_tree = hfs_btree_open(sb, HFSPLUS_ATTR_CNID);
if (!sbi->attr_tree)
pr_err("failed to load attributes file\n");
+ else
+ hfsplus_mark_inode_dirty(HFSPLUS_ATTR_TREE_I(sb), HFSPLUS_I_ATTR_DIRTY);
failed_header_node_init:
kfree(buf);
--
2.47.3
next prev parent reply other threads:[~2026-05-01 11:02 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-01 11:02 [PATCH 1/3] hfs/hfsplus: fix u32 overflow in check_and_correct_requested_length Tristan Madani
2026-05-01 11:02 ` [PATCH 2/3] hfs/hfsplus: initialize data buffer in hfs_bnode_read_u16 and hfs_bnode_read_u8 Tristan Madani
2026-05-04 23:29 ` Viacheslav Dubeyko
2026-05-01 11:02 ` Tristan Madani [this message]
2026-05-04 23:31 ` [PATCH 3/3] hfsplus: fix null pointer dereference in hfsplus_create_attributes_file Viacheslav Dubeyko
2026-05-04 23:27 ` [PATCH 1/3] hfs/hfsplus: fix u32 overflow in check_and_correct_requested_length Viacheslav Dubeyko
2026-05-05 11:12 ` [PATCH v2 0/2] hfs/hfsplus: fix OOB access and uninit-value in bnode operations Tristan Madani
2026-05-05 11:12 ` [PATCH v2 1/2] hfs/hfsplus: fix u32 overflow in check_and_correct_requested_length Tristan Madani
2026-05-07 22:02 ` Viacheslav Dubeyko
2026-05-05 11:12 ` [PATCH v2 2/2] hfs/hfsplus: zero-initialize buffer in hfs_bnode_read Tristan Madani
2026-05-06 19:23 ` Viacheslav Dubeyko
2026-05-07 16:37 ` Tristan Madani
2026-05-07 21:59 ` Viacheslav Dubeyko
2026-05-07 22:00 ` 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=20260501110218.29906-3-tristmd@gmail.com \
--to=tristmd@gmail.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=slava@dubeyko.com \
--cc=stable@vger.kernel.org \
--cc=syzbot+bc70a12e438dadba4fb4@syzkaller.appspotmail.com \
--cc=tristan@talencesecurity.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.