linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] exfat: fix memory leak in exfat_fill_super
@ 2025-11-23 12:13 YangWen
  2025-11-24  2:07 ` Namjae Jeon
  0 siblings, 1 reply; 2+ messages in thread
From: YangWen @ 2025-11-23 12:13 UTC (permalink / raw)
  To: linkinjeon, sj1557.seo, yuezhang.mo; +Cc: linux-fsdevel, linux-kernel, YangWen

If exFAT encounters errors during multiple mount operations, 'sbi' and 'nls' will not be released,
which will cause a memory leak.

Fixes: 719c1e1829166 ("exfat: add super block operations")
Signed-off-by: YangWen <anmuxixixi@gmail.com>
---
 fs/exfat/super.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/exfat/super.c b/fs/exfat/super.c
index 74d451f732c7..db28a426206c 100644
--- a/fs/exfat/super.c
+++ b/fs/exfat/super.c
@@ -722,10 +722,15 @@ static int exfat_fill_super(struct super_block *sb, struct fs_context *fc)
 	sb->s_root = NULL;
 
 free_table:
+	exfat_free_upcase_table(sbi);
 	exfat_free_bitmap(sbi);
 	brelse(sbi->boot_bh);
 
 check_nls_io:
+	unload_nls(sbi->nls_io);
+	exfat_free_iocharset(sbi);
+	sb->s_fs_info = NULL;
+	kfree(sbi);
 	return err;
 }
 
-- 
2.43.0


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

* Re: [PATCH] exfat: fix memory leak in exfat_fill_super
  2025-11-23 12:13 [PATCH] exfat: fix memory leak in exfat_fill_super YangWen
@ 2025-11-24  2:07 ` Namjae Jeon
  0 siblings, 0 replies; 2+ messages in thread
From: Namjae Jeon @ 2025-11-24  2:07 UTC (permalink / raw)
  To: YangWen; +Cc: sj1557.seo, yuezhang.mo, linux-fsdevel, linux-kernel

On Sun, Nov 23, 2025 at 9:13 PM YangWen <anmuxixixi@gmail.com> wrote:
>
> If exFAT encounters errors during multiple mount operations, 'sbi' and 'nls' will not be released,
> which will cause a memory leak.
delayed_free() will free them.
Please check it.
Thanks.
>
> Fixes: 719c1e1829166 ("exfat: add super block operations")
> Signed-off-by: YangWen <anmuxixixi@gmail.com>

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

end of thread, other threads:[~2025-11-24  2:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-23 12:13 [PATCH] exfat: fix memory leak in exfat_fill_super YangWen
2025-11-24  2:07 ` Namjae Jeon

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).