aboutsummaryrefslogtreecommitdiffstats
path: root/volumes.c
diff options
context:
space:
mode:
authorFilipe David Borba Manana <fdmanana@gmail.com>2013-07-29 19:36:36 +0100
committerDavid Sterba <dsterba@suse.cz>2013-09-03 19:40:45 +0200
commit02e778b2783f9a9ae89d0e4c8c25213fc5f750d1 (patch)
tree9da1722d6e49d53c52ced8dc7225e908f0b3bd9c /volumes.c
parent1c1725a07b384e13300b99ecf6816b6f78615691 (diff)
downloadbtrfs-progs-02e778b2783f9a9ae89d0e4c8c25213fc5f750d1.tar.gz
btrfs-progs-02e778b2783f9a9ae89d0e4c8c25213fc5f750d1.tar.xz
btrfs-progs-02e778b2783f9a9ae89d0e4c8c25213fc5f750d1.zip
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>
Diffstat (limited to 'volumes.c')
-rw-r--r--volumes.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/volumes.c b/volumes.c
index 582f333..6182ed6 100644
--- a/volumes.c
+++ b/volumes.c
@@ -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];