• Su Yue's avatar
    btrfs: Check name_len on add_inode_ref call path · 26a836ce
    Su Yue authored
    replay_one_buffer first reads buffers and dispatches items accroding to
    the item type.
    In this patch, add_inode_ref handles inode_ref and inode_extref.
    Then add_inode_ref calls ref_get_fields and extref_get_fields to read
    ref/extref name for the first time.
    So checking name_len before reading those two is fine.
    
    add_inode_ref also calls inode_in_dir to match ref/extref in parent_dir.
    The call graph includes btrfs_match_dir_item_name to read dir_item name
    in the parent dir.
    Checking first dir_item is not enough. Change it to verify every
    dir_item while doing matches.
    Signed-off-by: default avatarSu Yue <suy.fnst@cn.fujitsu.com>
    Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    26a836ce
dir-item.c 14.7 KB