]> git.baikalelectronics.ru Git - kernel.git/commit
block: fix memleak of bio integrity data
authorJustin Tee <justin.tee@broadcom.com>
Thu, 5 Dec 2019 02:09:01 +0000 (10:09 +0800)
committerJens Axboe <axboe@kernel.dk>
Thu, 5 Dec 2019 18:38:36 +0000 (11:38 -0700)
commit9ef2c758f3c318bad8fa7ec8ad87a76fc0cd257b
tree76f3d630387629bd6dcfa77163aa3aa94503cc07
parent9565a02d6fb8400a8ed94a3e50efe1f3db7cd93b
block: fix memleak of bio integrity data

f5cd1c92a2ad ("bio-integrity: stop abusing bi_end_io") moves
bio_integrity_free from bio_uninit() to bio_integrity_verify_fn()
and bio_endio(). This way looks wrong because bio may be freed
without calling bio_endio(), for example, blk_rq_unprep_clone() is
called from dm_mq_queue_rq() when the underlying queue of dm-mpath
is busy.

So memory leak of bio integrity data is caused by commit f5cd1c92a2ad.

Fixes this issue by re-adding bio_integrity_free() to bio_uninit().

Fixes: f5cd1c92a2ad ("bio-integrity: stop abusing bi_end_io")
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by Justin Tee <justin.tee@broadcom.com>

Add commit log, and simplify/fix the original patch wroten by Justin.

Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/bio-integrity.c
block/bio.c
block/blk.h