Skip to content

Commit b159f94

Browse files
David HildenbrandChristian Borntraeger
authored andcommitted
s390/gmap: don't unconditionally call pte_unmap_unlock() in __gmap_zap()
... otherwise we will try unlocking a spinlock that was never locked via a garbage pointer. At the time we reach this code path, we usually successfully looked up a PGSTE already; however, evil user space could have manipulated the VMA layout in the meantime and triggered removal of the page table. Fixes: 1e133ab ("s390/mm: split arch/s390/mm/pgtable.c") Signed-off-by: David Hildenbrand <david@redhat.com> Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com> Acked-by: Heiko Carstens <hca@linux.ibm.com> Link: https://lore.kernel.org/r/20210909162248.14969-3-david@redhat.com Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
1 parent 2d8fb8f commit b159f94

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎arch/s390/mm/gmap.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -689,9 +689,10 @@ void __gmap_zap(struct gmap *gmap, unsigned long gaddr)
689689

690690
/* Get pointer to the page table entry */
691691
ptep = get_locked_pte(gmap->mm, vmaddr, &ptl);
692-
if (likely(ptep))
692+
if (likely(ptep)) {
693693
ptep_zap_unused(gmap->mm, vmaddr, ptep, 0);
694-
pte_unmap_unlock(ptep, ptl);
694+
pte_unmap_unlock(ptep, ptl);
695+
}
695696
}
696697
}
697698
EXPORT_SYMBOL_GPL(__gmap_zap);

0 commit comments

Comments
 (0)