mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-11-01 17:08:10 +00:00
fs/ntfs3: Validate attribute data and valid sizes
commit019d22eb0e
upstream. The data_size and valid_size fields of non resident attributes should be less than the its alloc_size field, but this is not checked in ntfs_read_mft function. Syzbot reports a allocation order warning due to a large unchecked value of data_size getting assigned to inode->i_size which is then passed to kcalloc. Add sanity check for ensuring that the data_size and valid_size fields are not larger than alloc_size field. Link: https://syzkaller.appspot.com/bug?extid=fa4648a5446460b7b963 Reported-and-tested-by: syzbot+fa4648a5446460b7b963@syzkaller.appspotmail.com Fixes: (82cae269cf
) fs/ntfs3: Add initialization of super block Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com> Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
a5b9cb7276
commit
1692fedd0f
1 changed files with 7 additions and 0 deletions
|
@ -132,6 +132,13 @@ static struct inode *ntfs_read_mft(struct inode *inode,
|
|||
if (le16_to_cpu(attr->name_off) + attr->name_len > asize)
|
||||
goto out;
|
||||
|
||||
if (attr->non_res) {
|
||||
t64 = le64_to_cpu(attr->nres.alloc_size);
|
||||
if (le64_to_cpu(attr->nres.data_size) > t64 ||
|
||||
le64_to_cpu(attr->nres.valid_size) > t64)
|
||||
goto out;
|
||||
}
|
||||
|
||||
switch (attr->type) {
|
||||
case ATTR_STD:
|
||||
if (attr->non_res ||
|
||||
|
|
Loading…
Reference in a new issue