Re: [PATCH 3/3] btrfs: check namelen before read/memcmp_extent_buffer

2017-05-30 Thread Su Yue
On 05/29/2017 11:43 PM, David Sterba wrote: This patch adds the name length verification to many places and in some of them it looks unnecessary, as the directory item passes sanity checks already. The verification should always happen when we read the input, ie from disk, after search_slot

Re: [PATCH 3/3] btrfs: check namelen before read/memcmp_extent_buffer

2017-05-29 Thread David Sterba
This patch adds the name length verification to many places and in some of them it looks unnecessary, as the directory item passes sanity checks already. The verification should always happen when we read the input, ie from disk, after search_slot etc. Then, it can be considered valid and does not

[PATCH 3/3] btrfs: check namelen before read/memcmp_extent_buffer

2017-05-24 Thread Su Yue
Reading name using 'read_extent_buffer' and 'memcmp_extent_buffer' may cause read beyond item boundary if namelen field in dir_item, inode_ref is corrupted. Example: 1. Corrupt one dir_item namelen to be 255. 2. Run 'ls -lar /mnt/test/ > /dev/null' dmesg: [ 48.451449] BTRFS info