Skip to content
  • Filipe Manana's avatar
    Btrfs: fix invalid leaf slot access in btrfs_lookup_extent() · 1a4ed8fd
    Filipe Manana authored
    
    
    If we couldn't find our extent item, we accessed the current slot
    (path->slots[0]) to check if it corresponds to an equivalent skinny
    metadata item. However this slot could be beyond our last item in the
    leaf (i.e. path->slots[0] >= btrfs_header_nritems(leaf)), in which case
    we shouldn't process it.
    
    Since btrfs_lookup_extent() is only used to find extent items for data
    extents, fix this by removing completely the logic that looks up for an
    equivalent skinny metadata item, since it can not exist.
    
    Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
    Signed-off-by: default avatarChris Mason <clm@fb.com>
    1a4ed8fd