summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@suse.de>2006-08-11 22:29:11 +0200
committerAdrian Bunk <bunk@stusta.de>2006-08-11 22:29:11 +0200
commitdec0370af02c080b1a9c240058a9887fc53a5f08 (patch)
tree5010837f0a234d091fc28e693e5c1d20e320cf87
parent296b3f9ee6e8176e54229ef1d357b4e044c01fb2 (diff)
downloadlwn-dec0370af02c080b1a9c240058a9887fc53a5f08.tar.gz
lwn-dec0370af02c080b1a9c240058a9887fc53a5f08.zip
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: Adrian Bunk <bunk@stusta.de>
-rw-r--r--fs/bio.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/bio.c b/fs/bio.c
index 1f3bb501c262..7215911464e4 100644
--- 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++) {