Skip to contentSkip to conversation

Btrfs-progs: return immediately on tree search failure

PATCH New Filipe David Borba Manana 1 participant 1 message Jul 29, 2013 Btrfs file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 volumes.c |    2 ++
 1 file changed, 2 insertions(+)
volumes.c +2 -0
index 0ff2283..79008de 100644
@@ -1727,6 +1727,8 @@ int btrfs_read_chunk_tree(struct btrfs_root *root)
 	key.type = 0;
 again:
 	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];
Signature · 1 line
1.7.9.5