diff options
author | Qu Wenruo <wqu@suse.com> | 2018-07-05 15:45:56 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-08-06 15:03:07 +0200 |
commit | c010437455e95490ede7d8254bfdb0ec0159c715 (patch) | |
tree | 1ab1fa8c2ccaee2ddd9cf5a06d6f72179e15bf6b /check/main.c | |
parent | beb3ede39a21f61bd559f589a067d2847ce2c6d0 (diff) |
btrfs-progs: check: orig: Don't panic when unexpected root item is referring to one extent
With crafted image, expected root item can refer to certain extent, and
original mode uses BUG_ON() to handle such case.
Fix it by gracefully return error.
Link: https://bugzilla.kernel.org/show_bug.cgi?id=200403
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'check/main.c')
-rw-r--r-- | check/main.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/check/main.c b/check/main.c index 7c0e5a51..ceb6d8f5 100644 --- a/check/main.c +++ b/check/main.c @@ -3724,7 +3724,12 @@ static int check_owner_ref(struct btrfs_root *root, if (btrfs_header_owner(buf) == back->root) return 0; } - BUG_ON(rec->is_root); + /* + * Some unexpected root item referring to this one, return 1 to + * indicate owner not found + */ + if (rec->is_root) + return 1; /* try to find the block by search corresponding fs tree */ key.objectid = btrfs_header_owner(buf); |