* [PATCH] btrfs: fix memory leak in update_space_info failure path
@ 2017-05-17 13:49 jeffm
2017-05-19 0:20 ` Liu Bo
0 siblings, 1 reply; 2+ messages in thread
From: jeffm @ 2017-05-17 13:49 UTC (permalink / raw)
To: linux-btrfs; +Cc: Jeff Mahoney, # v3 . 14+
From: Jeff Mahoney <jeffm@suse.com>
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: <stable@vger.kernel.org> # v3.14+
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
fs/btrfs/extent-tree.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index be5477676cc8..2f23fd4a08f1 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -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;
}
--
2.11.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] btrfs: fix memory leak in update_space_info failure path
2017-05-17 13:49 [PATCH] btrfs: fix memory leak in update_space_info failure path jeffm
@ 2017-05-19 0:20 ` Liu Bo
0 siblings, 0 replies; 2+ messages in thread
From: Liu Bo @ 2017-05-19 0:20 UTC (permalink / raw)
To: jeffm; +Cc: linux-btrfs, # v3 . 14+
On Wed, May 17, 2017 at 09:49:37AM -0400, jeffm@suse.com wrote:
> From: Jeff Mahoney <jeffm@suse.com>
>
> 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: <stable@vger.kernel.org> # v3.14+
> Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Looks good.
Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
Thanks,
-liubo
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-05-19 0:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-17 13:49 [PATCH] btrfs: fix memory leak in update_space_info failure path jeffm
2017-05-19 0:20 ` Liu Bo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.