Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 896533a7 authored by Jeff Mahoney's avatar Jeff Mahoney Committed by David Sterba
Browse files

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: 6ab0a202 (btrfs: publish allocation data in sysfs)
Cc: <stable@vger.kernel.org> # v3.14+
Signed-off-by: default avatarJeff Mahoney <jeffm@suse.com>
Reviewed-by: default avatarLiu Bo <bo.li.liu@oracle.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent cc2b702c
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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;
	}