btrfs-progs: lowmem check: Fix function call stack overflow caused by wrong tree...
authorQu Wenruo <wqu@suse.com>
Wed, 22 Nov 2017 09:03:21 +0000 (17:03 +0800)
committerDavid Sterba <dsterba@suse.com>
Wed, 3 Jan 2018 16:09:19 +0000 (17:09 +0100)
commit77d47b4a3d304e52fd222c4bd21f9306e83037ac
treea85c35d06ddceb4f73e0615f784c5b02b4176b2d
parente6055097d12220c455468f01023e80c457b4e344
btrfs-progs: lowmem check: Fix function call stack overflow caused by wrong tree reloc tree detection

For reloc tree root, its backref points to itself.  So for such case,
we should finish the lookup.

Previous end condition is to ensure it's reloc tree *and* needs its root
bytenr to match the bytenr passed in.

However the @root passed can be another tree, e.g. other tree reloc root
which shares the node/leaf.  This makes any check based on @root passed
in invalid.

The patch removes the unreliable root objectid detection, and only uses
root->bytenr check.
For the possibility of invalid self-pointing backref, extent tree
checker should have already handled it, so we don't need to bother in
fs tree checker.

Fixes: 54c8f9152fd9 ("btrfs-progs: check: Fix lowmem mode stack overflow caused by fsck/023")
Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
cmds-check.c