]> git.baikalelectronics.ru Git - kernel.git/commit
fs/ntfs3: Validate attribute data and valid sizes
authorAbdun Nihaal <abdun.nihaal@gmail.com>
Tue, 4 Oct 2022 03:15:02 +0000 (08:45 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Feb 2023 10:28:26 +0000 (11:28 +0100)
commitd007f845810759971ab526326a62299d974dc475
tree7c52cdf3fbe0a61b51e52bba773c2cb36afdc0a8
parent720cc5964cebcefedc302f56bc7f0a02c4e26e67
fs/ntfs3: Validate attribute data and valid sizes

commit 019d22eb0eb707fc099e6e8fad9b3933236a06d0 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: (d446689e2f28a) 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>
fs/ntfs3/inode.c