Skip to content

Commit 11b9d0b

Browse files
hreineckekeithbusch
authored andcommitted
nvmet-tcp: always initialize tls_handshake_tmo_work
The TLS handshake timeout work item should always be initialized to avoid a crash when cancelling the workqueue. Fixes: 675b453 ("nvmet-tcp: enable TLS handshake upcall") Suggested-by: Maurizio Lombardi <[email protected]> Signed-off-by: Hannes Reinecke <[email protected]> Tested-by: Shin'ichiro Kawasaki <[email protected]> Tested-by: Yi Zhang <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Signed-off-by: Keith Busch <[email protected]>
1 parent 1c22e02 commit 11b9d0b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/nvme/target/tcp.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1854,6 +1854,8 @@ static int nvmet_tcp_tls_handshake(struct nvmet_tcp_queue *queue)
18541854
}
18551855
return ret;
18561856
}
1857+
#else
1858+
static void nvmet_tcp_tls_handshake_timeout(struct work_struct *w) {}
18571859
#endif
18581860

18591861
static void nvmet_tcp_alloc_queue(struct nvmet_tcp_port *port,
@@ -1911,9 +1913,9 @@ static void nvmet_tcp_alloc_queue(struct nvmet_tcp_port *port,
19111913
list_add_tail(&queue->queue_list, &nvmet_tcp_queue_list);
19121914
mutex_unlock(&nvmet_tcp_queue_mutex);
19131915

1914-
#ifdef CONFIG_NVME_TARGET_TCP_TLS
19151916
INIT_DELAYED_WORK(&queue->tls_handshake_tmo_work,
19161917
nvmet_tcp_tls_handshake_timeout);
1918+
#ifdef CONFIG_NVME_TARGET_TCP_TLS
19171919
if (queue->state == NVMET_TCP_Q_TLS_HANDSHAKE) {
19181920
struct sock *sk = queue->sock->sk;
19191921

0 commit comments

Comments
 (0)