summaryrefslogtreecommitdiff
path: root/arch/s390/mm/gup.c
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2013-10-08 07:29:09 (GMT)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2013-10-24 15:17:01 (GMT)
commiteb0bf929d5228ca0eb2758585f2e4e25aa20427e (patch)
tree68b30c431a0418d31feaca8046a9deab86172b7e /arch/s390/mm/gup.c
parent01997bbc924d63e6c4837c5d8dc190245bc473ec (diff)
downloadlinux-eb0bf929d5228ca0eb2758585f2e4e25aa20427e.tar.xz
s390/gup: handle zero nr_pages case correctly
If [__]get_user_pages_fast() gets called with nr_pages == 0, the current code would walk the page tables and pin as many pages until the first invalid pte (or the kernel crashed while writing struct page pointers to the pages array). So let's handle at least the nr_pages == 0 case correctly and exit early. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/mm/gup.c')
-rw-r--r--arch/s390/mm/gup.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/s390/mm/gup.c b/arch/s390/mm/gup.c
index d3a2b81..639fce46 100644
--- a/arch/s390/mm/gup.c
+++ b/arch/s390/mm/gup.c
@@ -180,7 +180,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) || (end > TASK_SIZE))
+ if ((end <= start) || (end > TASK_SIZE))
return 0;
/*
* local_irq_save() doesn't prevent pagetable teardown, but does