aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/relocation.c
diff options
context:
space:
mode:
authorLiu Bo <bo.li.liu@oracle.com>2016-07-12 13:29:37 -0400
committerDavid Sterba <dsterba@suse.com>2016-07-26 07:52:25 -0400
commit0fd8c3dae14fb64947842472940b807ca0781da9 (patch)
treea45c5235f5267739564328a3ee0ba6ecf96e73fe /fs/btrfs/relocation.c
parentbaf863b9c29617cc9eaf24e039f58846e700db48 (diff)
Btrfs: fix panic in balance due to EIO
During build_backref_tree(), if we fail to read a btree node, we can eventually run into BUG_ON(cache->nr_nodes) that we put in backref_cache_cleanup(), meaning we have at least one memory leak. This frees the backref_node that we's allocated at the very beginning of build_backref_tree(). Signed-off-by: Liu Bo <bo.li.liu@oracle.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/relocation.c')
-rw-r--r--fs/btrfs/relocation.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 13c9a48c83b0..97cafe7291b8 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -1171,8 +1171,12 @@ out:
1171 lower = list_entry(useless.next, 1171 lower = list_entry(useless.next,
1172 struct backref_node, list); 1172 struct backref_node, list);
1173 list_del_init(&lower->list); 1173 list_del_init(&lower->list);
1174 if (lower == node)
1175 node = NULL;
1174 free_backref_node(cache, lower); 1176 free_backref_node(cache, lower);
1175 } 1177 }
1178
1179 free_backref_node(cache, node);
1176 return ERR_PTR(err); 1180 return ERR_PTR(err);
1177 } 1181 }
1178 ASSERT(!node || !node->detached); 1182 ASSERT(!node || !node->detached);