bcachefs: Fix a memory leak in dio write path
Commit c42bca92be
"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: Kent Overstreet <kent.overstreet@gmail.com>
This commit is contained in:
committed by
Kent Overstreet
parent
120f63e321
commit
2ed5cd508d
@@ -2025,7 +2025,9 @@ ssize_t bch2_direct_write(struct kiocb *req, struct iov_iter *iter)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bio = bio_alloc_bioset(NULL,
|
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,
|
REQ_OP_WRITE,
|
||||||
GFP_KERNEL,
|
GFP_KERNEL,
|
||||||
&c->dio_write_bioset);
|
&c->dio_write_bioset);
|
||||||
|
Reference in New Issue
Block a user