diff options
author | Jens Axboe <axboe@suse.de> | 2006-08-11 22:29:11 +0200 |
---|---|---|
committer | Adrian Bunk <bunk@stusta.de> | 2006-08-11 22:29:11 +0200 |
commit | dec0370af02c080b1a9c240058a9887fc53a5f08 (patch) | |
tree | 5010837f0a234d091fc28e693e5c1d20e320cf87 /fs | |
parent | 296b3f9ee6e8176e54229ef1d357b4e044c01fb2 (diff) | |
download | lwn-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>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/bio.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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(¤t->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++) { |