summaryrefslogtreecommitdiffstats
path: root/drivers/nvme/target
diff options
context:
space:
mode:
authorSagi Grimberg <sagi@grimberg.me>2019-08-03 05:29:11 +0200
committerSagi Grimberg <sagi@grimberg.me>2019-08-29 21:55:01 +0200
commit35d1a938dcdaeb8e1d860f061a0cd11f67f42774 (patch)
treeee196d8e9535ce4cfe2ee346517d2d133b45d11d /drivers/nvme/target
parentnvmet-tcp: fix possible NULL deref (diff)
downloadlinux-35d1a938dcdaeb8e1d860f061a0cd11f67f42774.tar.xz
linux-35d1a938dcdaeb8e1d860f061a0cd11f67f42774.zip
nvmet-tcp: fix possible memory leak
when we uninit a command in error flow we also need to free an iovec if it was allocated. Reviewed-by: Max Gurtovoy <maxg@mellanox.com> Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Diffstat (limited to 'drivers/nvme/target')
-rw-r--r--drivers/nvme/target/tcp.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
index 0d63f3da0117..76e43750b9e5 100644
--- a/drivers/nvme/target/tcp.c
+++ b/drivers/nvme/target/tcp.c
@@ -1309,6 +1309,7 @@ static void nvmet_tcp_finish_cmd(struct nvmet_tcp_cmd *cmd)
{
nvmet_req_uninit(&cmd->req);
nvmet_tcp_unmap_pdu_iovec(cmd);
+ kfree(cmd->iov);
if (cmd->req.sg_cnt)
sgl_free(cmd->req.sg);
}