s390/mm: fix write access check in gup_huge_pmd()
authorGerald Schaefer <gerald.schaefer@de.ibm.com>
Mon, 18 Sep 2017 14:51:51 +0000 (16:51 +0200)
committerBen Hutchings <ben@decadent.org.uk>
Mon, 1 Jan 2018 20:50:50 +0000 (20:50 +0000)
commitc87f2285d0f94bbb594c2d768143e2569697df02
tree4de71ea07a5b3a074d590eea597a83250ab341a1
parent6c7d6c44646e59ef9443c51f60c251b907dbc180
s390/mm: fix write access check in gup_huge_pmd()

commit ba385c0594e723d41790ecfb12c610e6f90c7785 upstream.

The check for the _SEGMENT_ENTRY_PROTECT bit in gup_huge_pmd() is the
wrong way around. It must not be set for write==1, and not be checked for
write==0. Fix this similar to how it was fixed for ptes long time ago in
commit 25591b070336 ("[S390] fix get_user_pages_fast").

One impact of this bug would be unnecessarily using the gup slow path for
write==0 on r/w mappings. A potentially more severe impact would be that
gup_huge_pmd() will succeed for write==1 on r/o mappings.

Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
[bwh: Backported to 3.2:
 - Segment flag names are different
 - Adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
arch/s390/mm/gup.c