summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.com>2017-05-17 09:49:37 -0400
committerDavid Sterba <dsterba@suse.com>2017-06-01 16:56:31 +0200
commit896533a7da929136d0432713f02a3edffece2826 (patch)
tree0026603a4f0d5d5064a6602a6224dc2f3c28be9b /fs
parentcc2b702c52094b637a351d7491ac5200331d0445 (diff)
downloadlinux-896533a7da929136d0432713f02a3edffece2826.tar.bz2
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>
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 e390451c72e6..27ca5b81ed22 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -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;
}