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
Unified · Split
| @@ -779,8 +779,11 @@ int exfat_create_upcase_table(struct super_block *sb) · 778 unmodified lines | |||
| 779 | le32_to_cpu(ep->dentry.upcase.checksum)); | 779 | le32_to_cpu(ep->dentry.upcase.checksum)); |
| 780 | 780 | ||
| 781 | brelse(bh); | 781 | 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); | ||
| 783 | goto load_default; | 785 | goto load_default; |
| 786 | } | ||
| 784 | 787 | ||
| 785 | /* load successfully */ | 788 | /* load successfully */ |
| 786 | return ret; | 789 | return ret; |