diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/bio.c | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -834,6 +834,12 @@ struct bio *bio_copy_user_iov(struct request_queue *q, | |||
834 | end = (uaddr + iov[i].iov_len + PAGE_SIZE - 1) >> PAGE_SHIFT; | 834 | end = (uaddr + iov[i].iov_len + PAGE_SIZE - 1) >> PAGE_SHIFT; |
835 | start = uaddr >> PAGE_SHIFT; | 835 | start = uaddr >> PAGE_SHIFT; |
836 | 836 | ||
837 | /* | ||
838 | * Overflow, abort | ||
839 | */ | ||
840 | if (end < start) | ||
841 | return ERR_PTR(-EINVAL); | ||
842 | |||
837 | nr_pages += end - start; | 843 | nr_pages += end - start; |
838 | len += iov[i].iov_len; | 844 | len += iov[i].iov_len; |
839 | } | 845 | } |
@@ -962,6 +968,12 @@ static struct bio *__bio_map_user_iov(struct request_queue *q, | |||
962 | unsigned long end = (uaddr + len + PAGE_SIZE - 1) >> PAGE_SHIFT; | 968 | unsigned long end = (uaddr + len + PAGE_SIZE - 1) >> PAGE_SHIFT; |
963 | unsigned long start = uaddr >> PAGE_SHIFT; | 969 | unsigned long start = uaddr >> PAGE_SHIFT; |
964 | 970 | ||
971 | /* | ||
972 | * Overflow, abort | ||
973 | */ | ||
974 | if (end < start) | ||
975 | return ERR_PTR(-EINVAL); | ||
976 | |||
965 | nr_pages += end - start; | 977 | nr_pages += end - start; |
966 | /* | 978 | /* |
967 | * buffer must be aligned to at least hardsector size for now | 979 | * buffer must be aligned to at least hardsector size for now |
@@ -989,7 +1001,7 @@ static struct bio *__bio_map_user_iov(struct request_queue *q, | |||
989 | unsigned long start = uaddr >> PAGE_SHIFT; | 1001 | unsigned long start = uaddr >> PAGE_SHIFT; |
990 | const int local_nr_pages = end - start; | 1002 | const int local_nr_pages = end - start; |
991 | const int page_limit = cur_page + local_nr_pages; | 1003 | const int page_limit = cur_page + local_nr_pages; |
992 | 1004 | ||
993 | ret = get_user_pages_fast(uaddr, local_nr_pages, | 1005 | ret = get_user_pages_fast(uaddr, local_nr_pages, |
994 | write_to_vm, &pages[cur_page]); | 1006 | write_to_vm, &pages[cur_page]); |
995 | if (ret < local_nr_pages) { | 1007 | if (ret < local_nr_pages) { |