[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <6932f0d3.a70a0220.243dc6.000b.GAE@google.com>
Date: Fri, 05 Dec 2025 06:48:51 -0800
From: syzbot <syzbot+99f6ed51479b86ac4c41@...kaller.appspotmail.com>
To: linux-kernel@...r.kernel.org, syzkaller-bugs@...glegroups.com
Subject: Forwarded: [PATCH] hfsplus: fix memory leak in hfsplus_fill_super()
error path
For archival purposes, forwarding an incoming command email to
linux-kernel@...r.kernel.org, syzkaller-bugs@...glegroups.com.
***
Subject: [PATCH] hfsplus: fix memory leak in hfsplus_fill_super() error path
Author: kartikey406@...il.com
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
When hfsplus_fill_super() fails, the sbi structure is freed but neither
sb->s_fs_info nor fc->s_fs_info are set to NULL. Since sget_fc() copies
fc->s_fs_info to sb->s_fs_info without clearing fc->s_fs_info, both
pointers reference the same memory. After fill_super frees sbi,
hfsplus_free_fc() may operate on a dangling pointer, causing memory
leak or other issues.
Set both sb->s_fs_info and fc->s_fs_info to NULL after freeing sbi
in the error path to ensure proper cleanup.
Reported-by: syzbot+99f6ed51479b86ac4c41@...kaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=99f6ed51479b86ac4c41
Signed-off-by: Deepanshu Kartikey <kartikey406@...il.com>
---
fs/hfsplus/super.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c
index 54e85e25a259..f242b88f6633 100644
--- a/fs/hfsplus/super.c
+++ b/fs/hfsplus/super.c
@@ -630,6 +630,8 @@ static int hfsplus_fill_super(struct super_block *sb, struct fs_context *fc)
unload_nls(sbi->nls);
unload_nls(nls);
kfree(sbi);
+ sb->s_fs_info = NULL;
+ fc->s_fs_info = NULL;
return err;
}
--
2.43.0
Powered by blists - more mailing lists