Skip to content

Commit 14b1c7f

Browse files
YuezhangMoSasha Levin
authored and
Sasha Levin
committed
exfat: fix memory leak in exfat_load_bitmap()
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]>
1 parent ce1610e commit 14b1c7f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

fs/exfat/balloc.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -110,18 +110,18 @@ int exfat_load_bitmap(struct super_block *sb)
110110
return -EIO;
111111

112112
type = exfat_get_entry_type(ep);
113-
if (type == TYPE_UNUSED)
114-
break;
115-
if (type != TYPE_BITMAP)
116-
continue;
117-
if (ep->dentry.bitmap.flags == 0x0) {
113+
if (type == TYPE_BITMAP &&
114+
ep->dentry.bitmap.flags == 0x0) {
118115
int err;
119116

120117
err = exfat_allocate_bitmap(sb, ep);
121118
brelse(bh);
122119
return err;
123120
}
124121
brelse(bh);
122+
123+
if (type == TYPE_UNUSED)
124+
return -EINVAL;
125125
}
126126

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

0 commit comments

Comments
 (0)