Message ID | 1511520092-37101-4-git-send-email-gujx@cn.fujitsu.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
diff --git a/cmds-check.c b/cmds-check.c index 49b0792b..3f4244a2 100644 --- a/cmds-check.c +++ b/cmds-check.c @@ -4070,6 +4070,8 @@ static int check_fs_root(struct btrfs_root *root, wret = btrfs_search_slot(NULL, root, &key, &path, 0, 0); if (wret < 0) goto skip_walking; + if (!path.nodes[level]) + goto skip_walking; btrfs_node_key(path.nodes[level], &found_key, path.slots[level]); WARN_ON(memcmp(&found_key, &root_item->drop_progress,
The following test failed when trying to check tree below. item 9 key (TREE_RELOC ROOT_ITEM 0) itemoff 1135 itemsize 439 Since it has a inconsistent level in root and root->node, Segment fault accures when use btrfs_node_key after btrfs_search_slot. So add null pointer check before use btrfs_node_key. Here comes the error message: $ sudo TEST=003\* make test-fuzz failed (ignored, ret=139): /home/adam/btrfs/btrfs-progs/btrfs check --init-csum-tree /home/adam/btrfs/btrfs-progs/tests/fuzz-tests/images/bko-172811.raw.restored mayfail: returned code 139 (SEGFAULT), not ignored test failed for case 003-multi-check-unmounted Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com> --- cmds-check.c | 2 ++ 1 file changed, 2 insertions(+)