Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 221824
b: refs/heads/master
c: cb4644c
h: refs/heads/master
v: v3
  • Loading branch information
Jens Axboe committed Nov 10, 2010
1 parent de404f0 commit f27d0ad
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f3f63c1c28bc861a931fac283b5bc3585efb8967
refs/heads/master: cb4644cac4a2797afc847e6c92736664d4b0ea34
14 changes: 13 additions & 1 deletion trunk/fs/bio.c
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,12 @@ struct bio *bio_copy_user_iov(struct request_queue *q,
end = (uaddr + iov[i].iov_len + PAGE_SIZE - 1) >> PAGE_SHIFT;
start = uaddr >> PAGE_SHIFT;

/*
* Overflow, abort
*/
if (end < start)
return ERR_PTR(-EINVAL);

nr_pages += end - start;
len += iov[i].iov_len;
}
Expand Down Expand Up @@ -962,6 +968,12 @@ static struct bio *__bio_map_user_iov(struct request_queue *q,
unsigned long end = (uaddr + len + PAGE_SIZE - 1) >> PAGE_SHIFT;
unsigned long start = uaddr >> PAGE_SHIFT;

/*
* Overflow, abort
*/
if (end < start)
return ERR_PTR(-EINVAL);

nr_pages += end - start;
/*
* buffer must be aligned to at least hardsector size for now
Expand Down Expand Up @@ -989,7 +1001,7 @@ static struct bio *__bio_map_user_iov(struct request_queue *q,
unsigned long start = uaddr >> PAGE_SHIFT;
const int local_nr_pages = end - start;
const int page_limit = cur_page + local_nr_pages;

ret = get_user_pages_fast(uaddr, local_nr_pages,
write_to_vm, &pages[cur_page]);
if (ret < local_nr_pages) {
Expand Down

0 comments on commit f27d0ad

Please sign in to comment.