linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Btrfs-progs: return immediately on tree search failure
@ 2013-07-29 18:36 Filipe David Borba Manana
  0 siblings, 0 replies; only message in thread
From: Filipe David Borba Manana @ 2013-07-29 18:36 UTC (permalink / raw)
  To: linux-btrfs; +Cc: jbacik, Filipe David Borba Manana

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>
---
 volumes.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/volumes.c b/volumes.c
index 0ff2283..79008de 100644
--- a/volumes.c
+++ b/volumes.c
@@ -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];
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-07-29 18:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-29 18:36 [PATCH] Btrfs-progs: return immediately on tree search failure Filipe David Borba Manana

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).