Skip to content

Commit 896533a

Browse files
jeffmahoneykdave
authored andcommitted
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: 6ab0a20 (btrfs: publish allocation data in sysfs) Cc: <[email protected]> # v3.14+ Signed-off-by: Jeff Mahoney <[email protected]> Reviewed-by: Liu Bo <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent cc2b702 commit 896533a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

fs/btrfs/extent-tree.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3993,6 +3993,7 @@ static int update_space_info(struct btrfs_fs_info *info, u64 flags,
39933993
info->space_info_kobj, "%s",
39943994
alloc_name(found->flags));
39953995
if (ret) {
3996+
percpu_counter_destroy(&found->total_bytes_pinned);
39963997
kfree(found);
39973998
return ret;
39983999
}

0 commit comments

Comments
 (0)