Skip to content

Commit 5c7955c

Browse files
jeffmahoneygregkh
authored andcommitted
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: 6ab0a20 (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>
1 parent cc8c67c commit 5c7955c

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

fs/btrfs/extent-tree.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3854,6 +3854,7 @@ static int update_space_info(struct btrfs_fs_info *info, u64 flags,
38543854
info->space_info_kobj, "%s",
38553855
alloc_name(found->flags));
38563856
if (ret) {
3857+
percpu_counter_destroy(&found->total_bytes_pinned);
38573858
kfree(found);
38583859
return ret;
38593860
}

0 commit comments

Comments
 (0)