]> git.baikalelectronics.ru Git - kernel.git/commit
block: fix memory leak of bvec
authorMing Lei <ming.lei@redhat.com>
Tue, 2 Feb 2021 15:54:10 +0000 (23:54 +0800)
committerJens Axboe <axboe@kernel.dk>
Tue, 2 Feb 2021 15:57:56 +0000 (08:57 -0700)
commit8abd8dbe15b0d075a5c60b0d6cb2ba0c83a2b700
tree3a0d5a95e466bf5467e61206c284ae95938af1a0
parentfb6b7c12a8a67c1178aed0d866e25c5da278af85
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: c41485517608 ("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>
block/bio.c