Commit 609c9ea7 authored by Edward Adam Davis's avatar Edward Adam Davis Committed by Greg Kroah-Hartman
Browse files

fs/ntfs3: Fix WARNING in ntfs_extend_initialized_size



[ Upstream commit ff355926 ]

Syzbot reported a WARNING in ntfs_extend_initialized_size.
The data type of in->i_valid and to is u64 in ntfs_file_mmap().
If their values are greater than LLONG_MAX, overflow will occur because
the data types of the parameters valid and new_valid corresponding to
the function ntfs_extend_initialized_size() are loff_t.

Before calling ntfs_extend_initialized_size() in the ntfs_file_mmap(),
the "ni->i_valid < to" has been determined, so the same WARN_ON determination
is not required in ntfs_extend_initialized_size().
Just execute the ntfs_extend_initialized_size() in ntfs_extend() to make
a WARN_ON check.

Reported-and-tested-by: default avatar <syzbot+e37dd1dfc814b10caa55@syzkaller.appspotmail.com>
Closes: https://syzkaller.appspot.com/bug?extid=e37dd1dfc814b10caa55


Signed-off-by: default avatarEdward Adam Davis <eadavis@qq.com>
Signed-off-by: default avatarKonstantin Komarov <almaz.alexandrovich@paragon-software.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 27b12b58
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment