linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hfsplus: don't use BUG_ON() in hfsplus_create_attributes_file()
@ 2025-06-25 10:10 Tetsuo Handa
  2025-06-30 17:18 ` Viacheslav Dubeyko
  0 siblings, 1 reply; 14+ messages in thread
From: Tetsuo Handa @ 2025-06-25 10:10 UTC (permalink / raw)
  To: Viacheslav Dubeyko, John Paul Adrian Glaubitz, Yangtao Li,
	Andrew Morton
  Cc: linux-fsdevel, LKML

syzkaller can mount crafted filesystem images.
Don't crash the kernel when we can continue.

Reported-by: syzbot <syzbot+1107451c16b9eb9d29e6@syzkaller.appspotmail.com>
Closes: https://syzkaller.appspot.com/bug?extid=1107451c16b9eb9d29e6
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
---
 fs/hfsplus/xattr.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/fs/hfsplus/xattr.c b/fs/hfsplus/xattr.c
index 9a1a93e3888b..191767d4cf78 100644
--- a/fs/hfsplus/xattr.c
+++ b/fs/hfsplus/xattr.c
@@ -172,7 +172,11 @@ static int hfsplus_create_attributes_file(struct super_block *sb)
 		return PTR_ERR(attr_file);
 	}
 
-	BUG_ON(i_size_read(attr_file) != 0);
+	if (i_size_read(attr_file) != 0) {
+		err = -EIO;
+		pr_err("failed to load attributes file\n");
+		goto end_attr_file_creation;
+	}
 
 	hip = HFSPLUS_I(attr_file);
 
-- 
2.49.0

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2025-07-15 18:49 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-25 10:10 [PATCH] hfsplus: don't use BUG_ON() in hfsplus_create_attributes_file() Tetsuo Handa
2025-06-30 17:18 ` Viacheslav Dubeyko
2025-07-07 14:22   ` Yangtao Li
2025-07-07 14:45     ` Tetsuo Handa
2025-07-07 19:03       ` Viacheslav Dubeyko
2025-07-09 14:02         ` Tetsuo Handa
2025-07-09 18:33           ` Viacheslav Dubeyko
2025-07-09 22:03             ` Tetsuo Handa
2025-07-11 11:35               ` Tetsuo Handa
2025-07-11 17:21                 ` Viacheslav Dubeyko
2025-07-12 11:22                   ` Tetsuo Handa
2025-07-14 23:30                     ` Viacheslav Dubeyko
2025-07-15  5:17                       ` [PATCH v2] " Tetsuo Handa
2025-07-15 18:49                         ` Viacheslav Dubeyko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).