Skip to content

Commit 81b626e

Browse files
YuezhangMomehmetb0
authored andcommitted
exfat: fix memory leak in exfat_load_bitmap()
BugLink: https://bugs.launchpad.net/bugs/2089884 commit d2b537b upstream. If the first directory entry in the root directory is not a bitmap directory entry, 'bh' will not be released and reassigned, which will cause a memory leak. Fixes: 1e49a94 ("exfat: add bitmap operations") Cc: [email protected] Signed-off-by: Yuezhang Mo <[email protected]> Reviewed-by: Aoyama Wataru <[email protected]> Signed-off-by: Namjae Jeon <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Koichiro Den <[email protected]> Signed-off-by: Roxana Nicolescu <[email protected]>
1 parent 1878fd6 commit 81b626e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

fs/exfat/balloc.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,18 +91,18 @@ int exfat_load_bitmap(struct super_block *sb)
9191
return -EIO;
9292

9393
type = exfat_get_entry_type(ep);
94-
if (type == TYPE_UNUSED)
95-
break;
96-
if (type != TYPE_BITMAP)
97-
continue;
98-
if (ep->dentry.bitmap.flags == 0x0) {
94+
if (type == TYPE_BITMAP &&
95+
ep->dentry.bitmap.flags == 0x0) {
9996
int err;
10097

10198
err = exfat_allocate_bitmap(sb, ep);
10299
brelse(bh);
103100
return err;
104101
}
105102
brelse(bh);
103+
104+
if (type == TYPE_UNUSED)
105+
return -EINVAL;
106106
}
107107

108108
if (exfat_get_next_cluster(sb, &clu.dir))

0 commit comments

Comments
 (0)