Commit 2ed5cd50 authored by Kent Overstreet's avatar Kent Overstreet Committed by Kent Overstreet

bcachefs: Fix a memory leak in dio write path

Commit c42bca92 "bio: don't copy bvec
for direct IO" changed bio_iov_iter_get_pages() to point bio->bi_iovec
at the incoming biovec, meaning if we already allocated one, it'll be
leaked.
Signed-off-by: default avatarKent Overstreet <kent.overstreet@gmail.com>
parent 120f63e3
......@@ -2025,7 +2025,9 @@ ssize_t bch2_direct_write(struct kiocb *req, struct iov_iter *iter)
}
bio = bio_alloc_bioset(NULL,
iov_iter_npages(iter, BIO_MAX_VECS),
iov_iter_is_bvec(iter)
? 0
: iov_iter_npages(iter, BIO_MAX_VECS),
REQ_OP_WRITE,
GFP_KERNEL,
&c->dio_write_bioset);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment