mirror of
https://github.com/torvalds/linux.git
synced 2026-12-05 12:54:27 +00:00
mm/memory.c: prevent mapping typed pages to userspace
Pages which use page_type must never be mapped to userspace as it would destroy their page type. Add an explicit check for this instead of assuming that kernel drivers always get this right. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Matthew Wilcox <[email protected]> Reviewed-by: Kees Cook <[email protected]> Reviewed-by: David Hildenbrand <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Will Deacon <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
committed by
Linus Torvalds
parent
2d432cb709
commit
0ee930e6ca
+1
-1
@@ -1452,7 +1452,7 @@ static int insert_page(struct vm_area_struct *vma, unsigned long addr,
|
||||
spinlock_t *ptl;
|
||||
|
||||
retval = -EINVAL;
|
||||
if (PageAnon(page) || PageSlab(page))
|
||||
if (PageAnon(page) || PageSlab(page) || page_has_type(page))
|
||||
goto out;
|
||||
retval = -ENOMEM;
|
||||
flush_dcache_page(page);
|
||||
|
||||
Reference in New Issue
Block a user