ext4: add bounds checking to ext4_xattr_find_entry()

commit 9496005d6c upstream.

Add some paranoia checks to make sure we don't stray beyond the end of
the valid memory region containing ext4 xattr entries while we are
scanning for a match.

Also rename the function to xattr_find_entry() since it is static and
thus only used in fs/ext4/xattr.c

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
[bwh: Backported to 3.16:
 - Keep passing an explicit size to xattr_find_entry()
 - s/EFSCORRUPTED/EIO/]]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
This commit is contained in:
Theodore Ts'o 2018-03-30 20:00:56 -04:00 • committed by Ben Hutchings
commit 9fd4629252