aboutsummaryrefslogtreecommitdiffstats
path: root/fs/bio.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@suse.de>2006-06-16 07:02:29 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-17 13:52:12 -0400
commit991721572ef2140c6411894aebefd3377e71a9e7 (patch)
tree8264f83a60517616b860c0bce7d0e0413eb5c2cb /fs/bio.c
parent16070428d389ff47aa3476b0911179ad90c640a2 (diff)
[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>
Diffstat (limited to 'fs/bio.c')
-rw-r--r--fs/bio.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/bio.c b/fs/bio.c
index 098c12b2d60a..6a0b9ad8f8c9 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -654,9 +654,10 @@ static struct bio *__bio_map_user_iov(request_queue_t *q,
654 write_to_vm, 0, &pages[cur_page], NULL); 654 write_to_vm, 0, &pages[cur_page], NULL);
655 up_read(&current->mm->mmap_sem); 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 goto out_unmap; 659 goto out_unmap;
659 660 }
660 661
661 offset = uaddr & ~PAGE_MASK; 662 offset = uaddr & ~PAGE_MASK;
662 for (j = cur_page; j < page_limit; j++) { 663 for (j = cur_page; j < page_limit; j++) {