Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1729708

[PATCH 3.16 106/233] btrfs: fix memory leak in update_space_info failure path

From Ben Hutchings <ben@decadent.org.uk>
Newsgroups linux.kernel
Subject [PATCH 3.16 106/233] btrfs: fix memory leak in update_space_info failure path
Date 2017-09-10 01:10 +0200
Message-ID <unX2W-3Jz-19@gated-at.bofh.it> (permalink)
References <unWqd-3ep-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


3.16.48-rc1 review patch.  If anyone has any objections, please let me know.

------------------

From: Jeff Mahoney <jeffm@suse.com>

commit 896533a7da929136d0432713f02a3edffece2826 upstream.

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)
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: Ben Hutchings <ben@decadent.org.uk>
---
 fs/btrfs/extent-tree.c | 1 +
 1 file changed, 1 insertion(+)

--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -3526,6 +3526,7 @@ static int update_space_info(struct btrf
 				    info->space_info_kobj, "%s",
 				    alloc_name(found->flags));
 	if (ret) {
+		percpu_counter_destroy(&found->total_bytes_pinned);
 		kfree(found);
 		return ret;
 	}

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH 3.16 106/233] btrfs: fix memory leak in update_space_info  failure path Ben Hutchings <ben@decadent.org.uk> - 2017-09-10 01:10 +0200

csiph-web