]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
s390/gup: add missing TASK_SIZE check to get_user_pages_fast()
authorHeiko Carstens <heiko.carstens@de.ibm.com>
Mon, 22 Oct 2012 13:49:02 +0000 (15:49 +0200)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 6 Dec 2012 11:20:05 +0000 (11:20 +0000)
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 <gerald.schaefer@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
arch/s390/mm/gup.c

index 65cb06e2af4eaa0a7b18b2e3b0f5b4b1af8be9d8..4ccf9f54355ea99ad19a79dee66033cbeaab7dbf 100644 (file)
@@ -183,7 +183,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;
 
        /*