diff --git a/lib/iov_iter.c b/lib/iov_iter.c index 65ec660c2960..e19aab1fccca 100644 --- a/lib/iov_iter.c +++ b/lib/iov_iter.c @@ -1728,6 +1728,10 @@ static ssize_t iov_iter_extract_bvec_pages(struct iov_iter *i, (*pages)[k++] = bv.bv_page; size += bv.bv_len; + if (size > maxsize) { + size = maxsize; + break; + } if (k >= maxpages) break;