[PATCH 4.4 06/51] Btrfs: fix em leak in find_first_block_group

From: Greg Kroah-Hartman
Date: Tue Jan 15 2019 - 11:37:23 EST


4.4-stable review patch. If anyone has any objections, please let me know.

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

From: Josef Bacik <jbacik@xxxxxx>

commit 187ee58c62c1d0d238d3dc4835869d33e1869906 upstream.

We need to call free_extent_map() on the em we look up.

Signed-off-by: Josef Bacik <jbacik@xxxxxx>
Reviewed-by: Omar Sandoval <osandov@xxxxxx>
Signed-off-by: David Sterba <dsterba@xxxxxxxx>
Signed-off-by: Chris Mason <clm@xxxxxx>
Signed-off-by: Ben Hutchings <ben.hutchings@xxxxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
fs/btrfs/extent-tree.c | 1 +
1 file changed, 1 insertion(+)

--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -9518,6 +9518,7 @@ static int find_first_block_group(struct
} else {
ret = 0;
}
+ free_extent_map(em);
goto out;
}
path->slots[0]++;