Skip to content

Commit 190f4c2

Browse files
logostChristoph Hellwig
authored andcommitted
nvmet: fix memory leak of bio integrity
If nvmet receives commands with metadata there is a continuous memory leak of kmalloc-128 slab or more precisely bio->bi_integrity. Since commit bf4c89f ("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: bf4c89f ("block: don't call bio_uninit from bio_endio") Signed-off-by: Dmitry Bogdanov <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
1 parent ba806c9 commit 190f4c2

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/nvme/target/nvmet.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,8 @@ static inline void nvmet_req_bio_put(struct nvmet_req *req, struct bio *bio)
867867
{
868868
if (bio != &req->b.inline_bio)
869869
bio_put(bio);
870+
else
871+
bio_uninit(bio);
870872
}
871873

872874
#ifdef CONFIG_NVME_TARGET_TCP_TLS

0 commit comments

Comments
 (0)