Skip to content

Commit 0e32fdd

Browse files
tititiou36keithbusch
authored andcommitted
nvme-tcp: Fix a memory leak
All error handling path end to the error handling path, except this one. Go to the error handling branch as well here, otherwise 'icreq' and 'icresp' will leak. Fixes: 2837966 ("nvme-tcp: control message handling for recvmsg()") Signed-off-by: Christophe JAILLET <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Keith Busch <[email protected]>
1 parent 744eac7 commit 0e32fdd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/nvme/host/tcp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1423,13 +1423,14 @@ static int nvme_tcp_init_connection(struct nvme_tcp_queue *queue)
14231423
nvme_tcp_queue_id(queue), ret);
14241424
goto free_icresp;
14251425
}
1426+
ret = -ENOTCONN;
14261427
if (queue->ctrl->ctrl.opts->tls) {
14271428
ctype = tls_get_record_type(queue->sock->sk,
14281429
(struct cmsghdr *)cbuf);
14291430
if (ctype != TLS_RECORD_TYPE_DATA) {
14301431
pr_err("queue %d: unhandled TLS record %d\n",
14311432
nvme_tcp_queue_id(queue), ctype);
1432-
return -ENOTCONN;
1433+
goto free_icresp;
14331434
}
14341435
}
14351436
ret = -EINVAL;

0 commit comments

Comments
 (0)