Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

[PATCH] Fix missing ret assignment in __bio_map_user() error path

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: Linus Torvalds <torvalds@osdl.org>

authored by

Jens Axboe and committed by
Linus Torvalds
99172157 16070428

+3 -2
+3 -2
fs/bio.c
··· 654 654 write_to_vm, 0, &pages[cur_page], NULL); 655 655 up_read(&current->mm->mmap_sem); 656 656 657 - if (ret < local_nr_pages) 657 + if (ret < local_nr_pages) { 658 + ret = -EFAULT; 658 659 goto out_unmap; 659 - 660 + } 660 661 661 662 offset = uaddr & ~PAGE_MASK; 662 663 for (j = cur_page; j < page_limit; j++) {