ext4: check EA value offset when loading
authorDarrick J. Wong <darrick.wong@oracle.com>
Tue, 16 Sep 2014 18:34:59 +0000 (14:34 -0400)
committerBen Hutchings <ben@decadent.org.uk>
Sun, 14 Dec 2014 16:23:42 +0000 (16:23 +0000)
commit2f3007855abfd0a7b9ac0925b20bbf972cc0e347
tree26819a87abc933239e5d3b421b603d02c4060856
parent7e6ccbbb11dbb844cf79ea7e9250ef0d41a52830
ext4: check EA value offset when loading

commit a0626e75954078cfacddb00a4545dde821170bc5 upstream.

When loading extended attributes, check each entry's value offset to
make sure it doesn't collide with the entries.

Without this check it is easy to crash the kernel by mounting a
malicious FS containing a file with an EA wherein e_value_offs = 0 and
e_value_size > 0 and then deleting the EA, which corrupts the name
list.

(See the f_ea_value_crash test's FS image in e2fsprogs for an example.)

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
fs/ext4/xattr.c