* [PATCH] btrfs-progs: Fix 2 extent buffer leak in btrfs-debug-tree.
@ 2015-02-11 1:57 Qu Wenruo
2015-02-11 2:02 ` Qu Wenruo
0 siblings, 1 reply; 3+ messages in thread
From: Qu Wenruo @ 2015-02-11 1:57 UTC (permalink / raw)
To: linux-btrfs; +Cc: dsterba
There are 2 known extent buffer:
1) With -t option.
-t option will skip other tree roots, but it will read the root node
first and then skip it.
Where it forgets to free the tree block it read.
2) with -b option.
It forgets to free the tree block it read.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
---
btrfs-debug-tree.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/btrfs-debug-tree.c b/btrfs-debug-tree.c
index ce7a792..610624e 100644
--- a/btrfs-debug-tree.c
+++ b/btrfs-debug-tree.c
@@ -221,6 +221,7 @@ int main(int ac, char **av)
goto close_root;
}
btrfs_print_tree(root, leaf, 0);
+ free_extent_buffer(leaf);
goto close_root;
}
@@ -284,8 +285,10 @@ again:
0);
if (!extent_buffer_uptodate(buf))
goto next;
- if (tree_id && found_key.objectid != tree_id)
+ if (tree_id && found_key.objectid != tree_id) {
+ free_extent_buffer(buf);
goto next;
+ }
switch(found_key.objectid) {
case BTRFS_ROOT_TREE_OBJECTID:
--
2.3.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs-progs: Fix 2 extent buffer leak in btrfs-debug-tree.
2015-02-11 1:57 [PATCH] btrfs-progs: Fix 2 extent buffer leak in btrfs-debug-tree Qu Wenruo
@ 2015-02-11 2:02 ` Qu Wenruo
2015-02-11 18:08 ` David Sterba
0 siblings, 1 reply; 3+ messages in thread
From: Qu Wenruo @ 2015-02-11 2:02 UTC (permalink / raw)
To: linux-btrfs; +Cc: dsterba
-------- Original Message --------
Subject: [PATCH] btrfs-progs: Fix 2 extent buffer leak in btrfs-debug-tree.
From: Qu Wenruo <quwenruo@cn.fujitsu.com>
To: <linux-btrfs@vger.kernel.org>
Date: 2015年02月11日 09:57
> There are 2 known extent buffer:
Oh, a small typo: "2 known extent buffer leak:", missing the word leak.
> 1) With -t option.
> -t option will skip other tree roots, but it will read the root node
> first and then skip it.
> Where it forgets to free the tree block it read.
>
> 2) with -b option.
> It forgets to free the tree block it read.
>
> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
> ---
> btrfs-debug-tree.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/btrfs-debug-tree.c b/btrfs-debug-tree.c
> index ce7a792..610624e 100644
> --- a/btrfs-debug-tree.c
> +++ b/btrfs-debug-tree.c
> @@ -221,6 +221,7 @@ int main(int ac, char **av)
> goto close_root;
> }
> btrfs_print_tree(root, leaf, 0);
> + free_extent_buffer(leaf);
> goto close_root;
> }
>
> @@ -284,8 +285,10 @@ again:
> 0);
> if (!extent_buffer_uptodate(buf))
> goto next;
> - if (tree_id && found_key.objectid != tree_id)
> + if (tree_id && found_key.objectid != tree_id) {
> + free_extent_buffer(buf);
> goto next;
> + }
>
> switch(found_key.objectid) {
> case BTRFS_ROOT_TREE_OBJECTID:
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs-progs: Fix 2 extent buffer leak in btrfs-debug-tree.
2015-02-11 2:02 ` Qu Wenruo
@ 2015-02-11 18:08 ` David Sterba
0 siblings, 0 replies; 3+ messages in thread
From: David Sterba @ 2015-02-11 18:08 UTC (permalink / raw)
To: Qu Wenruo; +Cc: linux-btrfs, dsterba
On Wed, Feb 11, 2015 at 10:02:14AM +0800, Qu Wenruo wrote:
> > There are 2 known extent buffer:
> Oh, a small typo: "2 known extent buffer leak:", missing the word leak.
Fixed and applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-02-11 18:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-11 1:57 [PATCH] btrfs-progs: Fix 2 extent buffer leak in btrfs-debug-tree Qu Wenruo
2015-02-11 2:02 ` Qu Wenruo
2015-02-11 18:08 ` David Sterba
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.