summaryrefslogtreecommitdiff
path: root/drivers/nvme
diff options
context:
space:
mode:
authorDmitry Bogdanov <d.bogdanov@yadro.com>2025-06-25 14:45:33 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-07-10 16:04:49 +0200
commit431e58d56fcb5ff1f9eb630724a922e0d2a941df (patch)
treee79eec6c10b5c98c6cc51161678e741ca67e09f3 /drivers/nvme
parentf0fee863a7cb6f9b4277562d5310193758308e1b (diff)
downloadlinux-431e58d56fcb5ff1f9eb630724a922e0d2a941df.tar.gz
linux-431e58d56fcb5ff1f9eb630724a922e0d2a941df.tar.bz2
linux-431e58d56fcb5ff1f9eb630724a922e0d2a941df.zip
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 commit bf4c89fc8797 ("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: bf4c89fc8797 ("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>
Diffstat (limited to 'drivers/nvme')
-rw-r--r--drivers/nvme/target/nvmet.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h
index 190f55e6d753..3062562c096a 100644
--- a/drivers/nvme/target/nvmet.h
+++ b/drivers/nvme/target/nvmet.h
@@ -714,6 +714,8 @@ static inline void nvmet_req_bio_put(struct nvmet_req *req, struct bio *bio)
{
if (bio != &req->b.inline_bio)
bio_put(bio);
+ else
+ bio_uninit(bio);
}
#ifdef CONFIG_NVME_TARGET_AUTH