diff options
| author | Keith Busch <kbusch@kernel.org> | 2026-05-06 16:16:02 +0300 |
|---|---|---|
| committer | Keith Busch <kbusch@kernel.org> | 2026-05-11 18:07:39 +0300 |
| commit | 2279cd9c61a330e5de4d6eb0bc422820dd6fdf36 (patch) | |
| tree | c955cbba7b156f9bc94d0872139125e0175fbb23 /drivers | |
| parent | ce28b772c3c28fb1c62a81533045ae90ed3b496c (diff) | |
| download | linux-2279cd9c61a330e5de4d6eb0bc422820dd6fdf36.tar.xz | |
nvme: fix bio leak on mapping failure
The local bio is always NULL, so we'd leak the bio if the integrity
mapping failed. Just get it directly from the request.
Fixes: d0d1d522316e91f ("blk-map: provide the bdev to bio if one exists")
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/nvme/host/ioctl.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/nvme/host/ioctl.c b/drivers/nvme/host/ioctl.c index e232188ccd02..08889b20e5d8 100644 --- a/drivers/nvme/host/ioctl.c +++ b/drivers/nvme/host/ioctl.c @@ -121,7 +121,6 @@ static int nvme_map_user_request(struct request *req, u64 ubuffer, struct block_device *bdev = ns ? ns->disk->part0 : NULL; bool supports_metadata = bdev && blk_get_integrity(bdev->bd_disk); bool has_metadata = meta_buffer && meta_len; - struct bio *bio = NULL; int ret; if (has_metadata && !supports_metadata) @@ -145,8 +144,8 @@ static int nvme_map_user_request(struct request *req, u64 ubuffer, return ret; out_unmap: - if (bio) - blk_rq_unmap_user(bio); + if (req->bio) + blk_rq_unmap_user(req->bio); return ret; } |
