[PATCH] Fix segmentation fault when opening invalid file system

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Hubert Kario <kario@xxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux