Re: [PATCH 2/3] btrfs: check namelen with boundary in verify dir_item

2017-05-29 Thread David Sterba
On Thu, May 25, 2017 at 10:09:07AM +0800, Su Yue wrote: > @@ -472,6 +474,15 @@ int verify_dir_item(struct btrfs_fs_info *fs_info, > return 1; > } > > + namelen = btrfs_dir_name_len(leaf, dir_item); > + namelen_ret = btrfs_check_namelen(leaf, slot, > +

[PATCH 2/3] btrfs: check namelen with boundary in verify dir_item

2017-05-24 Thread Su Yue
Origin 'verify_dir_item' verify namelen of dir_item with fixed values but no item boundary. If corrupted namelen was not bigger than the fixed value, for example 255, the function will think the dir_item is fine. And then reading beyond boundary will cause crash. Add a parameter 'slot' and check n