nvmet: fix memory leak of bio integrity
[ Upstream commit 190f4c2c863af7cc5bb354b70e0805f06419c038 ] If nvmet receives commands with metadata there is a continuous memory leak of kmalloc-128 slab or more precisely bio->bi_integrity. Since commitbf4c89fc87("block: don't call bio_uninit from bio_endio") each user of bio_init has to use bio_uninit as well. Otherwise the bio integrity is not getting free. Nvmet uses bio_init for inline bios. Uninit the inline bio to complete deallocation of integrity in bio. Fixes:bf4c89fc87("block: don't call bio_uninit from bio_endio") Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
f0fee863a7
commit
431e58d56f
@@ -714,6 +714,8 @@ static inline void nvmet_req_bio_put(struct nvmet_req *req, struct bio *bio)
|
|||||||
{
|
{
|
||||||
if (bio != &req->b.inline_bio)
|
if (bio != &req->b.inline_bio)
|
||||||
bio_put(bio);
|
bio_put(bio);
|
||||||
|
else
|
||||||
|
bio_uninit(bio);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_NVME_TARGET_AUTH
|
#ifdef CONFIG_NVME_TARGET_AUTH
|
||||||
|
|||||||
Reference in New Issue
Block a user