Skip to contentSkip to conversation

nvmet-tcp: do not try to cancel uninitialized tls_handshake_tmo_work

PATCH In review Hannes Reinecke 2 participants 2 messages Oct 19, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 nvmet-tcp: do not try to cancel uninitialized tls_handshake_tmo_work

The TLS handshake timeout workqueue is only initialized if TLS is configured, so we shouldn't try to de-initialize it unconditionally.

Fixes 675b453e0241 ("nvmet-tcp: enable TLS handshake upcall")
---
 drivers/nvme/target/tcp.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/nvme/target/tcp.c +2 -0
index 4336fe048e43..e155bcaa42fa 100644
@@ -1587,7 +1587,9 @@ static void nvmet_tcp_release_queue_work(struct work_struct *w)
 	mutex_unlock(&nvmet_tcp_queue_mutex);
 
 	nvmet_tcp_restore_socket_callbacks(queue);
+#ifdef CONFIG_NVME_TARGET_TCP_TLS
 	cancel_delayed_work_sync(&queue->tls_handshake_tmo_work);
+#endif
 	cancel_work_sync(&queue->io_work);
 	/* stop accepting incoming data */
 	queue->rcv_state = NVMET_TCP_RECV_ERR;
Signature · 1 line
2.35.3
maintainer
#1 lore raw
Quoted 3 lines · Hannes Reinecke

The TLS handshake timeout workqueue is only initialized if TLS is configured, so we shouldn't try to de-initialize it unconditionally.

Please fix this properly rather than working around it. Either put the work item inside CONFIG_NVME_TARGET_TCP_TLS so that any unintended use can't happen in the future, or just initialize the darn thing at setup time rather than have this conditional.

Signature · 1 line
Jens Axboe