Hubert Kario
2012-Feb-19 20:11 UTC
[PATCH] Fix segmentation fault when opening invalid file system
Signed-off-by: Hubert Kario <kario@wit.edu.pl> --- btrfslabel.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/btrfslabel.c b/btrfslabel.c index c9f4684..3c3566b 100644 --- a/btrfslabel.c +++ b/btrfslabel.c @@ -55,6 +55,8 @@ static void change_label_unmounted(char *dev, char *nLabel) * and as read-write. */ root = open_ctree(dev, 0, 1); + if (!root) /* errors are printed by open_ctree() */ + return; trans = btrfs_start_transaction(root, 1); strncpy(root->fs_info->super_copy.label, nLabel, BTRFS_LABEL_SIZE); -- 1.7.9 -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at vger.kernel.org/majordomo-info.html