mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-16 16:54:20 +08:00
btrfs: fix memory leak in update_space_info failure path
If we fail to add the space_info kobject, we'll leak the memory
for the percpu counter.
Fixes: 6ab0a2029c
(btrfs: publish allocation data in sysfs)
Cc: <stable@vger.kernel.org> # v3.14+
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
cc2b702c52
commit
896533a7da
@ -3993,6 +3993,7 @@ static int update_space_info(struct btrfs_fs_info *info, u64 flags,
|
||||
info->space_info_kobj, "%s",
|
||||
alloc_name(found->flags));
|
||||
if (ret) {
|
||||
percpu_counter_destroy(&found->total_bytes_pinned);
|
||||
kfree(found);
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user