diff options
author | Jens Axboe <axboe@suse.de> | 2006-06-16 13:02:29 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-17 10:52:12 -0700 |
commit | 991721572ef2140c6411894aebefd3377e71a9e7 (patch) | |
tree | 8264f83a60517616b860c0bce7d0e0413eb5c2cb /fs | |
parent | 16070428d389ff47aa3476b0911179ad90c640a2 (diff) | |
download | linux-3.10-991721572ef2140c6411894aebefd3377e71a9e7.tar.gz linux-3.10-991721572ef2140c6411894aebefd3377e71a9e7.tar.bz2 linux-3.10-991721572ef2140c6411894aebefd3377e71a9e7.zip |
[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')
-rw-r--r-- | fs/bio.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -654,9 +654,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++) { |