From c4f0e5cfde354b1d6cf2388c0920264985c6c139 Mon Sep 17 00:00:00 2001 From: Heiko Carstens Date: Tue, 24 Aug 2021 15:21:44 +0200 Subject: s390/mm,pageattr: fix walk_pte_level() early exit In case of splitting to 4k mapping the early exit in walk_pte_level() must only be taken iff flags is equal to SET_MEMORY_4K. Currently the early exit is taken if the flag is set, and also others might be set. This may lead to the situation that a mapping is split but other changes are not done, like e.g. setting pages to R/W. There is currently no such caller, but there might be in the future. Fixes: b3e1a00c8fa4 ("s390/mm: implement set_memory_4k()") Signed-off-by: Heiko Carstens --- arch/s390/mm/pageattr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'arch/s390') diff --git a/arch/s390/mm/pageattr.c b/arch/s390/mm/pageattr.c index 45197b71d55f..fdc86c0e4e6c 100644 --- a/arch/s390/mm/pageattr.c +++ b/arch/s390/mm/pageattr.c @@ -86,7 +86,7 @@ static int walk_pte_level(pmd_t *pmdp, unsigned long addr, unsigned long end, { pte_t *ptep, new; - if ((flags & SET_MEMORY_4K) == SET_MEMORY_4K) + if (flags == SET_MEMORY_4K) return 0; ptep = pte_offset_kernel(pmdp, addr); do { -- cgit v1.2.3