diff --git a/lib/iov_iter.c b/lib/iov_iter.c index 65ec660c296065a22997a3727087dee8f3906aa5..8d4cdc295913fdcb4339b75575e3a72f0dbcaeae 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;