Files
linux/fs/ntfs
Desmond Cheong Zhi Xi 00f00f5db8 ntfs: fix validity check for file name attribute
commit d98e4d9541 upstream.

When checking the file name attribute, we want to ensure that it fits
within the bounds of ATTR_RECORD.  To do this, we should check that (attr
record + file name offset + file name length) < (attr record + attr record
length).

However, the original check did not include the file name offset in the
calculation.  This means that corrupted on-disk metadata might not caught
by the incorrect file name check, and lead to an invalid memory access.

An example can be seen in the crash report of a memory corruption error
found by Syzbot:
https://syzkaller.appspot.com/bug?id=a1a1e379b225812688566745c3e2f7242bffc246

Adding the file name offset to the validity check fixes this error and
passes the Syzbot reproducer test.

Link: https://lkml.kernel.org/r/20210614050540.289494-1-desmondcheongzx@gmail.com
Signed-off-by: Desmond Cheong Zhi Xi <desmondcheongzx@gmail.com>
Reported-by: syzbot+213ac8bb98f7f4420840@syzkaller.appspotmail.com
Tested-by: syzbot+213ac8bb98f7f4420840@syzkaller.appspotmail.com
Acked-by: Anton Altaparmakov <anton@tuxera.com>
Cc: Shuah Khan <skhan@linuxfoundation.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-07-20 16:15:39 +02:00
..
2018-08-17 16:20:27 -07:00
2005-04-16 15:20:36 -07:00
2018-08-17 16:20:27 -07:00
2014-10-09 22:25:46 -04:00
2014-04-07 16:35:49 -07:00
2005-04-16 15:20:36 -07:00
2005-04-16 15:20:36 -07:00
2015-06-23 18:01:59 -04:00
2009-01-22 13:15:55 +03:00
2011-03-31 11:26:23 -03:00
2015-06-24 17:49:38 -07:00
2018-08-17 16:20:27 -07:00
2005-04-16 15:20:36 -07:00
2016-01-22 18:04:28 -05:00
2011-03-31 11:26:23 -03:00
2006-12-07 08:39:23 -08:00
2008-05-24 09:56:08 -07:00