In preparation for having single segment iovec imports be transformed into ITER_UBUF, ensure that process_madvise() deals with those correctly when iterating the iov_iter. Signed-off-by: Jens Axboe <axboe@xxxxxxxxx> --- mm/madvise.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mm/madvise.c b/mm/madvise.c index 340125d08c03..2bd0f6c067bb 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -1503,7 +1503,12 @@ SYSCALL_DEFINE5(process_madvise, int, pidfd, const struct iovec __user *, vec, total_len = iov_iter_count(&iter); while (iov_iter_count(&iter)) { - iovec = iov_iter_iovec(&iter); + if (iter_is_ubuf(&iter)) { + iovec.iov_base = iter.ubuf + iter.iov_offset; + iovec.iov_len = iov_iter_count(&iter); + } else { + iovec = iov_iter_iovec(&iter); + } ret = do_madvise(mm, (unsigned long)iovec.iov_base, iovec.iov_len, behavior); if (ret < 0) -- 2.39.2