]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Fix missing ret assignment in __bio_map_user() error path
authorJens Axboe <axboe@suse.de>
Fri, 11 Aug 2006 20:29:11 +0000 (22:29 +0200)
committerAdrian Bunk <bunk@stusta.de>
Fri, 11 Aug 2006 20:29:11 +0000 (22:29 +0200)
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>
fs/bio.c

index 1f3bb501c262bc9b94ad9e0b73c5af8acc511c90..7215911464e4adcb3853043affc0196b87458f99 100644 (file)
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -655,9 +655,10 @@ static struct bio *__bio_map_user_iov(request_queue_t *q,
                                     write_to_vm, 0, &pages[cur_page], NULL);
                up_read(&current->mm->mmap_sem);
 
-               if (ret < local_nr_pages)
+               if (ret < local_nr_pages) {
+                       ret = -EFAULT;
                        goto out_unmap;
-
+               }
 
                offset = uaddr & ~PAGE_MASK;
                for (j = cur_page; j < page_limit; j++) {