mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-30 22:26:55 +00:00
block: fix memory leak of bvec
bio_init() clears bio instance, so the bvec index has to be set after
bio_init(), otherwise bio->bi_io_vec may be leaked.
Fixes: 3175199ab0
("block: split bio_kmalloc from bio_alloc_bioset")
Cc: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Cc: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Cc: Damien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
a42e0d70c5
commit
8358c28a5d
1 changed files with 1 additions and 1 deletions
|
@ -482,8 +482,8 @@ struct bio *bio_alloc_bioset(gfp_t gfp_mask, unsigned int nr_iovecs,
|
||||||
if (unlikely(!bvl))
|
if (unlikely(!bvl))
|
||||||
goto err_free;
|
goto err_free;
|
||||||
|
|
||||||
bio->bi_flags |= idx << BVEC_POOL_OFFSET;
|
|
||||||
bio_init(bio, bvl, bvec_nr_vecs(idx));
|
bio_init(bio, bvl, bvec_nr_vecs(idx));
|
||||||
|
bio->bi_flags |= idx << BVEC_POOL_OFFSET;
|
||||||
} else if (nr_iovecs) {
|
} else if (nr_iovecs) {
|
||||||
bio_init(bio, bio->bi_inline_vecs, BIO_INLINE_VECS);
|
bio_init(bio, bio->bi_inline_vecs, BIO_INLINE_VECS);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue