Skip to content
  • Qu Wenruo's avatar
    btrfs-progs: Use more strict check to read out tree root · d00a875e
    Qu Wenruo authored
    
    
    Fuzzed image bko-156811-bad-parent-ref-qgroup-verify.raw causes qgroup
    to report -ENOMEM.
    
    But the fact is, such image is heavily damaged so there is no valid root
    item for the extent tree.
    
    Normal extent tree key in root tree should be (EXTENT_TREE ROOT_ITEM 0),
    while in that fuzzed image, we got (EXTENT_TREE EXXTENT_DATA SOME_NUMBER).
    
    It's btrfs_find_last_root() that only checks the objectid, not caring
    about the key type leading to such problem.
    
    Fix it by doing extra check on key type.
    
    Signed-off-by: default avatarQu Wenruo <quwenruo@cn.fujitsu.com>
    [ edit changelog ]
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    d00a875e