mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git
synced 2024-11-16 00:34:32 +08:00
Btrfs-progs: fail gracefully on error from open_ctree()
Error checking block got moved mistakenly exposing us to a potential segmentation fault. Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
This commit is contained in:
parent
fdb6c04023
commit
d5734e8837
9
mkfs.c
9
mkfs.c
@ -1328,7 +1328,12 @@ int main(int ac, char **av)
|
||||
fprintf(stderr, "error during mkfs %d\n", ret);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
root = open_ctree(file, 0, O_RDWR);
|
||||
if (!root) {
|
||||
fprintf(stderr, "ctree init failed\n");
|
||||
exit(1);
|
||||
}
|
||||
root->fs_info->alloc_start = alloc_start;
|
||||
|
||||
ret = make_root_dir(root, mixed);
|
||||
@ -1343,10 +1348,6 @@ int main(int ac, char **av)
|
||||
goto raid_groups;
|
||||
|
||||
btrfs_register_one_device(file);
|
||||
if (!root) {
|
||||
fprintf(stderr, "ctree init failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
zero_end = 1;
|
||||
while(ac-- > 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user