If get_user_pages() returns less pages than what we asked for, we
jump to out_unmap which will return ERR_PTR(ret). But ret can contain
a positive number just smaller than local_nr_pages, so be sure to set
it to -EFAULT always.
Problem found and diagnosed by Damien Le Moal <damien@sdl.hitachi.co.jp>
Signed-off-by: Jens Axboe <axboe@suse.de>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
write_to_vm, 0, &pages[cur_page], NULL);
up_read(¤t->mm->mmap_sem);
write_to_vm, 0, &pages[cur_page], NULL);
up_read(¤t->mm->mmap_sem);
- if (ret < local_nr_pages)
+ if (ret < local_nr_pages) {
+ ret = -EFAULT;
offset = uaddr & ~PAGE_MASK;
for (j = cur_page; j < page_limit; j++) {
offset = uaddr & ~PAGE_MASK;
for (j = cur_page; j < page_limit; j++) {