btrfs: fix memory leak in update_space_info failure path
Subsystems (2)
PATCH 1/1 btrfs: fix memory leak in update_space_info failure path
From: Jeff Mahoney <[email protected]>
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 <[email protected]> # v3.14+
Signed-off-by Jeff Mahoney <[email protected]>
--- fs/btrfs/extent-tree.c | 1 + 1 file changed, 1 insertion(+)
fs/btrfs/extent-tree.c +1 -0
@@ -3983,6 +3983,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; }
Signature · 1 line
2.11.0
Quoted 8 lines · On Wed, May 17, 2017 at 09:49:37AM -0400, [email protected] wrote:
From: Jeff Mahoney <[email protected]>
If we fail to add the
space_infokobject, we'll leak the memory for the percpu counter.Fixes 6ab0a2029c (btrfs: publish allocation data in sysfs)Cc <[email protected]> # v3.14+Signed-off-by Jeff Mahoney <[email protected]>
Looks good.
Reviewed-by Liu Bo <[email protected]>
Thanks,
-liubo