android_kernel_samsung_msm8976/include
Al Viro c079079279 fix fault_in_multipages_...() on architectures with no-op access_ok()
commit e23d4159b109167126e5bcd7f3775c95de7fee47 upstream.

Switching iov_iter fault-in to multipages variants has exposed an old
bug in underlying fault_in_multipages_...(); they break if the range
passed to them wraps around.  Normally access_ok() done by callers will
prevent such (and it's a guaranteed EFAULT - ERR_PTR() values fall into
such a range and they should not point to any valid objects).

However, on architectures where userland and kernel live in different
MMU contexts (e.g. s390) access_ok() is a no-op and on those a range
with a wraparound can reach fault_in_multipages_...().

Since any wraparound means EFAULT there, the fix is trivial - turn
those

    while (uaddr <= end)
	    ...
into

    if (unlikely(uaddr > end))
	    return -EFAULT;
    do
	    ...
    while (uaddr <= end);

Reported-by: Jan Stancek <jstancek@redhat.com>
Tested-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
2019-07-27 21:42:14 +02:00
..
acpi
asm-generic asm-generic: make copy_from_user() zero the destination properly 2019-07-27 21:42:13 +02:00
clocksource
crypto crypto: af_alg - Allow af_af_alg_release_parent to be called on nokey path 2019-07-27 21:42:07 +02:00
drm Merge remote-tracking branch 'f2fs/linux-3.10.y' into HEAD 2017-04-18 17:02:28 +02:00
dt-bindings
keys
kvm
linux fix fault_in_multipages_...() on architectures with no-op access_ok() 2019-07-27 21:42:14 +02:00
math-emu
media Merge tag 'LA.BR.1.3.6-03510-8976.0' into HEAD 2017-04-18 12:11:50 +02:00
memory
misc
net This is the 3.10.99 stable release 2017-04-18 17:17:46 +02:00
pcmcia
ras
rdma
rxrpc
scsi Import latest Samsung release 2017-04-18 03:43:52 +02:00
sdp Import latest Samsung release 2017-04-18 03:43:52 +02:00
soc/qcom Merge tag 'LA.BR.1.3.6-03910-8976.0' of https://source.codeaurora.org/quic/la/kernel/msm-3.10 into HEAD 2017-05-26 13:28:48 +02:00
sound ANDROID: sound: rawmidi: Hold lock around realloc 2018-05-26 00:39:34 +02:00
target
trace Merge remote-tracking branch 'f2fs/linux-3.10.y' into HEAD 2017-04-18 17:02:28 +02:00
uapi allow O_TMPFILE to work with O_WRONLY 2018-12-03 11:52:37 +01:00
video
xen Merge remote-tracking branch 'f2fs/linux-3.10.y' into HEAD 2017-04-18 17:02:28 +02:00
Kbuild