btrfsprogs/0137-Btrfs-progs-fail-gracefully-on-error-from-open_ctree.patch
David Sterba db07609875 - btrfs-progs-fix-open_ctree_usage_segfaults.patch: fix
segfaults from bnc#710486 due to unchecked usage of return
  value of open_ctree()
  [fixed compilation warnings]

- pull upstream, replace existing patches, spec update
- update 'restore' utility
  - lzo support
  - tools may now take earlies superblock when opening the fs
  - other fixes
- pull integration-20111030 branch
  - mkfs: force mkfs if desired
  - other fixes
- add btrfs-dump-super to mkinitrd
- other fixes
  - skip non-existent devices or without media
  - documentation updates
  - scrubbing single device
  - graceful error handling when opening fs fails

- updated mkinitrd script to scan devices before mount (bnc#727383)

OBS-URL: https://build.opensuse.org/package/show/filesystems/btrfsprogs?expand=0&rev=115
2011-12-14 23:25:51 +00:00

46 lines
1.1 KiB
Diff

From 670b953e28c25f835b713a22b03b9b0f86d8e025 Mon Sep 17 00:00:00 2001
From: Ilya Dryomov <idryomov@gmail.com>
Date: Tue, 1 Nov 2011 23:47:22 +0200
Subject: [PATCH 137/138] 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>
---
mkfs.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/mkfs.c b/mkfs.c
index d39c5a7..d4d13af 100644
--- a/mkfs.c
+++ b/mkfs.c
@@ -1359,7 +1359,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");
+ return -1;
+ }
root->fs_info->alloc_start = alloc_start;
ret = make_root_dir(root, mixed);
@@ -1374,10 +1379,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) {
--
1.7.6.233.gd79bc