[PATCH 3.16 028/245] Btrfs: fix em leak in find_first_block_group

From: Ben Hutchings
Date: Thu Apr 23 2020 - 19:24:53 EST


3.16.83-rc1 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>
Signed-off-by: Ben Hutchings <ben@xxxxxxxxxxxxxxx>
---
fs/btrfs/extent-tree.c | 1 +
1 file changed, 1 insertion(+)

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