mm, gup: add missing refcount overflow checks on s390
authorVlastimil Babka <vbabka@suse.cz>
Fri, 29 Nov 2019 09:03:51 +0000 (10:03 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Dec 2019 08:21:25 +0000 (09:21 +0100)
commit44efbdc479d0e0a45b4257d709dab7bf0f4b8033
treef3e9e54dced1c02a203ec8857fe5069dbab0b843
parentd00bd54f9994f9c1c8b0d302daba70e32c552d59
mm, gup: add missing refcount overflow checks on s390

The mainline commit 8fde12ca79af ("mm: prevent get_user_pages() from
overflowing page refcount") was backported to 4.19.y stable as commit
d972ebbf42ba. The backport however missed that in 4.19, there are several
arch-specific gup.c versions with fast gup implementations, so these do not
prevent refcount overflow.

This stable-only commit fixes the s390 version, and is based on the backport in
SUSE SLES/openSUSE 4.12-based kernels.

The remaining architectures with own gup.c are sparc, mips, sh. It's unlikely
the known overflow scenario based on FUSE, which needs 140GB of RAM, is a
problem for those architectures, and I don't feel confident enough to patch
them.

Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/s390/mm/gup.c