Skip to content

Commit af21250

Browse files
maurizio-lombardiChristoph Hellwig
authored andcommitted
nvmet-tcp: fix memory leak when performing a controller reset
If a reset controller is executed while the initiator is performing some I/O the driver may leak the memory allocated for the commands' iovec. Make sure that nvmet_tcp_uninit_data_in_cmds() releases all the memory. Signed-off-by: Maurizio Lombardi <[email protected]> Reviewed-by: Keith Busch <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Reviewed-by: John Meneghini <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
1 parent 69b85e1 commit af21250

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/nvme/target/tcp.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1427,7 +1427,10 @@ static void nvmet_tcp_uninit_data_in_cmds(struct nvmet_tcp_queue *queue)
14271427

14281428
for (i = 0; i < queue->nr_cmds; i++, cmd++) {
14291429
if (nvmet_tcp_need_data_in(cmd))
1430-
nvmet_tcp_finish_cmd(cmd);
1430+
nvmet_req_uninit(&cmd->req);
1431+
1432+
nvmet_tcp_unmap_pdu_iovec(cmd);
1433+
nvmet_tcp_free_cmd_buffers(cmd);
14311434
}
14321435

14331436
if (!queue->nr_cmds && nvmet_tcp_need_data_in(&queue->connect)) {

0 commit comments

Comments
 (0)