Skip to content

Commit 341468e

Browse files
Ming Leiaxboe
authored andcommitted
lib/iov_iter: fix bvec iterator setup
.bi_size of bvec iterator should be initialized as real max size for walking, and .bi_bvec_done just counts how many bytes need to be skipped in the 1st bvec, so .bi_size isn't related with .bi_bvec_done. This patch fixes bvec iterator initialization, and the inner `size` check isn't needed any more, so revert Eric Dumazet's commit 7bc802acf193 ("iov-iter: do not return more bytes than requested in iov_iter_extract_bvec_pages()"). Cc: Eric Dumazet <edumazet@google.com> Fixes: e4e535b ("iov_iter: don't require contiguous pages in iov_iter_extract_bvec_pages") Reported-by: syzbot+71abe7ab2b70bca770fd@syzkaller.appspotmail.com Tested-by: syzbot+71abe7ab2b70bca770fd@syzkaller.appspotmail.com Signed-off-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent d47de6a commit 341468e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/iov_iter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1700,7 +1700,7 @@ static ssize_t iov_iter_extract_bvec_pages(struct iov_iter *i,
17001700
skip = 0;
17011701
}
17021702
bi.bi_idx = 0;
1703-
bi.bi_size = maxsize + skip;
1703+
bi.bi_size = maxsize;
17041704
bi.bi_bvec_done = skip;
17051705

17061706
maxpages = want_pages_array(pages, maxsize, skip, maxpages);

0 commit comments

Comments
 (0)