summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.com>2017-05-17 09:49:37 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-06-14 15:06:02 +0200
commit66d6448475c682099e4dd3c6b4ef6e94248c0b2e (patch)
tree2769f88a18ac572fcbd6d5b8c8a4e4b68691b1c8 /fs
parent4d15ab90ec2bece7361b6afebebfbf83a381a529 (diff)
btrfs: fix memory leak in update_space_info failure path
commit 896533a7da929136d0432713f02a3edffece2826 upstream. 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) 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/extent-tree.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 5909ae8c6731..e46e7fbe1b34 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -3984,6 +3984,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;
}