diff options
author | Nikolay Borisov <nborisov@suse.com> | 2018-06-18 14:10:39 +0300 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-08-06 14:59:56 +0200 |
commit | a7773d7f0671aa28a20aa3a736f930e8d1cdbba9 (patch) | |
tree | 8dfc3f0241b1901c850f637d6b35e93a75d68d7f /check/main.c | |
parent | 014a0db6cbc09b720e832e9e069028b52dd0bc11 (diff) |
btrfs-progs: check: Fix wrong root parameter of btrfs_next_leaf call
The first thing that check_chunks_and_extents does is to iterate all
the root items in the root tree and link them to either the "normal_list"
or "dropping_trees" list. If a leaf has to be crossed during this
operation btrfs_next_leaf is called to do that. However, currently it's
called with a wrong argument for its 'root' parameter. Since we are
iterating the root tree the passed root should be fs_info->tree_rot,
whereas right now we are passing the local variable 'root' which is
assigned to the fs_tree. As it stands, this bug is actually benign since
the passed root is only passed to reada_for_search, where it's used to
reference the fs_info. Nevertheless the code is wrong and at the very least
misleading, so fix it by passing the correct root.
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Su Yue <suy.fnst@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'check/main.c')
-rw-r--r-- | check/main.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/check/main.c b/check/main.c index 3190b5d4..2a74e7d2 100644 --- a/check/main.c +++ b/check/main.c @@ -8163,7 +8163,7 @@ again: leaf = path.nodes[0]; slot = path.slots[0]; if (slot >= btrfs_header_nritems(path.nodes[0])) { - ret = btrfs_next_leaf(root, &path); + ret = btrfs_next_leaf(fs_info->tree_root, &path); if (ret != 0) break; leaf = path.nodes[0]; |