Mike Kravetz 0c82bca7cd hugetlbfs: fix bug in pgoff overflow checking
commit 5df63c2a149ae65a9ec239e7c2af44efa6f79beb upstream.

This is a fix for a regression in 32 bit kernels caused by an invalid
check for pgoff overflow in hugetlbfs mmap setup.  The check incorrectly
specified that the size of a loff_t was the same as the size of a long.
The regression prevents mapping hugetlbfs files at offsets greater than
4GB on 32 bit kernels.

On 32 bit kernels conversion from a page based unsigned long can not
overflow a loff_t byte offset.  Therefore, skip this check if
sizeof(unsigned long) != sizeof(loff_t).

Link: http://lkml.kernel.org/r/20180330145402.5053-1-mike.kravetz@oracle.com
Fixes: 63489f8e8211 ("hugetlbfs: check for pgoff value overflow")
Reported-by: Dan Rue <dan.rue@linaro.org>
Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
Tested-by: Anders Roxell <anders.roxell@linaro.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Yisheng Xie <xieyisheng1@huawei.com>
Cc: "Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>
Cc: Nic Losby <blurbdust@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-08 13:05:15 +01:00
..
2016-10-15 12:09:13 -07:00
2018-12-08 13:05:10 +01:00
2017-08-06 18:59:43 -07:00
2018-12-05 19:42:40 +01:00
2018-11-21 09:26:03 +01:00
2017-11-30 08:39:04 +00:00
2018-11-13 11:17:01 -08:00
2018-06-06 16:44:38 +02:00
2017-06-14 15:06:00 +02:00
2016-09-27 21:20:53 -04:00
2016-09-27 18:47:38 -04:00
2018-05-16 10:08:42 +02:00
2018-02-17 13:21:15 +01:00
2017-06-14 15:06:01 +02:00