From 02e778b2783f9a9ae89d0e4c8c25213fc5f750d1 Mon Sep 17 00:00:00 2001 From: Filipe David Borba Manana Date: Mon, 29 Jul 2013 19:36:36 +0100 Subject: 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 Signed-off-by: David Sterba Signed-off-by: Chris Mason --- volumes.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'volumes.c') diff --git a/volumes.c b/volumes.c index 582f3336..6182ed6c 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]; -- cgit v1.2.3