summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSagi Grimberg <sagi@grimberg.me>2019-08-03 06:29:11 +0300
committerSagi Grimberg <sagi@grimberg.me>2019-08-29 22:55:01 +0300
commit35d1a938dcdaeb8e1d860f061a0cd11f67f42774 (patch)
treeee196d8e9535ce4cfe2ee346517d2d133b45d11d
parentb627200762c7e8153fe1620fdd52a68f4ca2f8a5 (diff)
downloadlinux-35d1a938dcdaeb8e1d860f061a0cd11f67f42774.tar.xz
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>
-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);
}