Thread (100 messages) 100 messages, 5 authors, 2012-12-09

[ 11/89] s390/gup: add missing TASK_SIZE check to get_user_pages_fast()

From: Ben Hutchings <hidden>
Date: 2012-12-03 14:35:53
Also in: lkml
Subsystem: s390 architecture, the rest · Maintainers: Heiko Carstens, Vasily Gorbik, Alexander Gordeev, Linus Torvalds

3.2-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Heiko Carstens <redacted>

commit d55c4c613fc4d4ad2ba0fc6fa2b57176d420f7e4 upstream.

When walking page tables we need to make sure that everything
is within bounds of the ASCE limit of the task's address space.
Otherwise we might calculate e.g. a pud pointer which is not
within a pud and dereference it.
So check against TASK_SIZE (which is the ASCE limit) before
walking page tables.

Reviewed-by: Gerald Schaefer <redacted>
Signed-off-by: Heiko Carstens <redacted>
Signed-off-by: Martin Schwidefsky <redacted>
Signed-off-by: Ben Hutchings <redacted>
---
 arch/s390/mm/gup.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/s390/mm/gup.c b/arch/s390/mm/gup.c
index 8b82853..16fb3c1 100644
--- a/arch/s390/mm/gup.c
+++ b/arch/s390/mm/gup.c
@@ -229,7 +229,7 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write,
 	addr = start;
 	len = (unsigned long) nr_pages << PAGE_SHIFT;
 	end = start + len;
-	if (end < start)
+	if ((end < start) || (end > TASK_SIZE))
 		goto slow_irqon;
 
 	/*

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help