exfat: fix memory leak in exfat_load_bitmap()
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: 1e49a94cf7
("exfat: add bitmap operations")
Cc: stable@vger.kernel.org
Signed-off-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Reviewed-by: Aoyama Wataru <wataru.aoyama@sony.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
This commit is contained in:
parent
f761fcdd28
commit
d2b537b3e5
@ -91,11 +91,8 @@ int exfat_load_bitmap(struct super_block *sb)
|
|||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
type = exfat_get_entry_type(ep);
|
type = exfat_get_entry_type(ep);
|
||||||
if (type == TYPE_UNUSED)
|
if (type == TYPE_BITMAP &&
|
||||||
break;
|
ep->dentry.bitmap.flags == 0x0) {
|
||||||
if (type != TYPE_BITMAP)
|
|
||||||
continue;
|
|
||||||
if (ep->dentry.bitmap.flags == 0x0) {
|
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = exfat_allocate_bitmap(sb, ep);
|
err = exfat_allocate_bitmap(sb, ep);
|
||||||
@ -103,6 +100,9 @@ int exfat_load_bitmap(struct super_block *sb)
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
brelse(bh);
|
brelse(bh);
|
||||||
|
|
||||||
|
if (type == TYPE_UNUSED)
|
||||||
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exfat_get_next_cluster(sb, &clu.dir))
|
if (exfat_get_next_cluster(sb, &clu.dir))
|
||||||
|
Loading…
Reference in New Issue
Block a user