linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lin Ming <mlin@kernel.org>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH] btrfs-progs: fix segfault in walk_down_tree
Date: Thu,  2 May 2013 10:46:43 +0800	[thread overview]
Message-ID: <1367462803-6630-1-git-send-email-mlin@kernel.org> (raw)

walk_down_tree will fault when read_tree_block fails with NULL returned.

Signed-off-by: Lin Ming <mlin@kernel.org>
---
 cmds-check.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/cmds-check.c b/cmds-check.c
index 12192fa..e4435d5 100644
--- a/cmds-check.c
+++ b/cmds-check.c
@@ -1256,6 +1256,8 @@ static int walk_down_tree(struct btrfs_root *root, struct btrfs_path *path,
 			reada_walk_down(root, cur, path->slots[*level]);
 			next = read_tree_block(root, bytenr, blocksize,
 					       ptr_gen);
+			if (!next)
+				goto out;
 		}
 
 		*level = *level - 1;
-- 
1.7.2.5


             reply	other threads:[~2013-05-02  2:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-02  2:46 Lin Ming [this message]
2013-05-02  4:32 ` [PATCH] btrfs-progs: fix segfault in walk_down_tree Eric Sandeen
2013-05-02 15:32   ` Lin Ming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1367462803-6630-1-git-send-email-mlin@kernel.org \
    --to=mlin@kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).