Btrfs-progs: return immediately on tree search failure

If the chunk tree search failed in volumes.c:btrfs_read_chunk_tree()
return immediately, rather than looping and use the invalid contents
of the path structure, causing weird errors/crash at run time.

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
master
Filipe David Borba Manana 2013-07-29 19:36:36 +01:00 committed by David Sterba
parent 1c1725a07b
commit 02e778b278
1 changed files with 2 additions and 0 deletions

View File

@ -1717,6 +1717,8 @@ int btrfs_read_chunk_tree(struct btrfs_root *root)
key.offset = 0;
key.type = 0;
ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
if (ret < 0)
goto error;
while(1) {
leaf = path->nodes[0];
slot = path->slots[0];