diff mbox

[04/13] Btrfs-progs: Fix a segmentation fault in btrfstune when <device> is invalid.

Message ID 1358715858-4469-5-git-send-email-gene@czarc.net (mailing list archive)
State New, archived
Headers show

Commit Message

Gene Czarcinski Jan. 20, 2013, 9:04 p.m. UTC
From: Chen Yang <chenyang.fnst@cn.fujitsu.com>

When open_ctree(device, ...) failed, the return value should be checked.

Signed-off-by: Cheng Yang <chenyang.fnst@cn.fujitsu.com>
Signed-off-by: Gene Czarcinski <gene@czarc.net>
---
 btrfstune.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox

Patch

diff --git a/btrfstune.c b/btrfstune.c
index 47830c5..07648d5 100644
--- a/btrfstune.c
+++ b/btrfstune.c
@@ -107,6 +107,8 @@  int main(int argc, char *argv[])
 	}
 
 	root = open_ctree(device, 0, 1);
+	if (!root)
+		return 1;
 
 	if (seeding_flag) {
 		ret = update_seeding_flag(root, seeding_value);