Skip to content

Commit c290fe5

Browse files
danieltherealyangnamjaejeon
authored andcommitted
exfat: resolve memory leak from exfat_create_upcase_table()
If exfat_load_upcase_table reaches end and returns -EINVAL, allocated memory doesn't get freed and while exfat_load_default_upcase_table allocates more memory, leading to a memory leak. Here's link to syzkaller crash report illustrating this issue: https://syzkaller.appspot.com/text?tag=CrashReport&x=1406c201980000 Reported-by: syzbot+e1c69cadec0f1a078e3d@syzkaller.appspotmail.com Fixes: a13d1a4 ("exfat: move freeing sbi, upcase table and dropping nls into rcu-delayed helper") Cc: stable@vger.kernel.org Signed-off-by: Daniel Yang <danielyangkang@gmail.com> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
1 parent 6630ea4 commit c290fe5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

fs/exfat/nls.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,8 +779,11 @@ int exfat_create_upcase_table(struct super_block *sb)
779779
le32_to_cpu(ep->dentry.upcase.checksum));
780780

781781
brelse(bh);
782-
if (ret && ret != -EIO)
782+
if (ret && ret != -EIO) {
783+
/* free memory from exfat_load_upcase_table call */
784+
exfat_free_upcase_table(sbi);
783785
goto load_default;
786+
}
784787

785788
/* load successfully */
786789
return ret;

0 commit comments

Comments
 (0)