public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCHv3] nvmet-tcp: always initialize tls_handshake_tmo_work
@ 2023-10-20  5:06 Hannes Reinecke
  2023-11-10 11:40 ` Yi Zhang
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Hannes Reinecke @ 2023-10-20  5:06 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: Keith Busch, Sagi Grimberg, linux-nvme, Hannes Reinecke,
	Maurizio Lombardi

The TLS handshake timeout work item should always be
initialized to avoid a crash when cancelling the workqueue.

Fixes: 675b453e0241 ("nvmet-tcp: enable TLS handshake upcall")
Suggested-by: Maurizio Lombardi <mlombard@redhat.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/nvme/target/tcp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
index 4336fe048e43..b3c1cc6690f6 100644
--- a/drivers/nvme/target/tcp.c
+++ b/drivers/nvme/target/tcp.c
@@ -1856,6 +1856,8 @@ static int nvmet_tcp_tls_handshake(struct nvmet_tcp_queue *queue)
 	}
 	return ret;
 }
+#else
+static void nvmet_tcp_tls_handshake_timeout(struct work_struct *w) {}
 #endif
 
 static void nvmet_tcp_alloc_queue(struct nvmet_tcp_port *port,
@@ -1913,9 +1915,9 @@ static void nvmet_tcp_alloc_queue(struct nvmet_tcp_port *port,
 	list_add_tail(&queue->queue_list, &nvmet_tcp_queue_list);
 	mutex_unlock(&nvmet_tcp_queue_mutex);
 
-#ifdef CONFIG_NVME_TARGET_TCP_TLS
 	INIT_DELAYED_WORK(&queue->tls_handshake_tmo_work,
 			  nvmet_tcp_tls_handshake_timeout);
+#ifdef CONFIG_NVME_TARGET_TCP_TLS
 	if (queue->state == NVMET_TCP_Q_TLS_HANDSHAKE) {
 		struct sock *sk = queue->sock->sk;
 
-- 
2.35.3



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCHv3] nvmet-tcp: always initialize tls_handshake_tmo_work
  2023-10-20  5:06 [PATCHv3] nvmet-tcp: always initialize tls_handshake_tmo_work Hannes Reinecke
@ 2023-11-10 11:40 ` Yi Zhang
  2023-11-16 11:00 ` Shinichiro Kawasaki
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Yi Zhang @ 2023-11-10 11:40 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: Christoph Hellwig, Keith Busch, Sagi Grimberg, linux-nvme,
	Maurizio Lombardi

Tested-by: Yi Zhang <yi.zhang@redhat.com>

Confirmed below issue was fixed by this patch.
https://lore.kernel.org/linux-nvme/CAHj4cs_Lprbh1zWsJ2yT6+qhNoqjrGDrBgx+XOYvU9SLpmLTtw@mail.gmail.com/


On Fri, Oct 20, 2023 at 1:14 PM Hannes Reinecke <hare@suse.de> wrote:
>
> The TLS handshake timeout work item should always be
> initialized to avoid a crash when cancelling the workqueue.
>
> Fixes: 675b453e0241 ("nvmet-tcp: enable TLS handshake upcall")
> Suggested-by: Maurizio Lombardi <mlombard@redhat.com>
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
>  drivers/nvme/target/tcp.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
> index 4336fe048e43..b3c1cc6690f6 100644
> --- a/drivers/nvme/target/tcp.c
> +++ b/drivers/nvme/target/tcp.c
> @@ -1856,6 +1856,8 @@ static int nvmet_tcp_tls_handshake(struct nvmet_tcp_queue *queue)
>         }
>         return ret;
>  }
> +#else
> +static void nvmet_tcp_tls_handshake_timeout(struct work_struct *w) {}
>  #endif
>
>  static void nvmet_tcp_alloc_queue(struct nvmet_tcp_port *port,
> @@ -1913,9 +1915,9 @@ static void nvmet_tcp_alloc_queue(struct nvmet_tcp_port *port,
>         list_add_tail(&queue->queue_list, &nvmet_tcp_queue_list);
>         mutex_unlock(&nvmet_tcp_queue_mutex);
>
> -#ifdef CONFIG_NVME_TARGET_TCP_TLS
>         INIT_DELAYED_WORK(&queue->tls_handshake_tmo_work,
>                           nvmet_tcp_tls_handshake_timeout);
> +#ifdef CONFIG_NVME_TARGET_TCP_TLS
>         if (queue->state == NVMET_TCP_Q_TLS_HANDSHAKE) {
>                 struct sock *sk = queue->sock->sk;
>
> --
> 2.35.3
>
>


-- 
Best Regards,
  Yi Zhang



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCHv3] nvmet-tcp: always initialize tls_handshake_tmo_work
  2023-10-20  5:06 [PATCHv3] nvmet-tcp: always initialize tls_handshake_tmo_work Hannes Reinecke
  2023-11-10 11:40 ` Yi Zhang
@ 2023-11-16 11:00 ` Shinichiro Kawasaki
  2023-11-20 10:40 ` Sagi Grimberg
  2023-11-20 17:25 ` Keith Busch
  3 siblings, 0 replies; 5+ messages in thread
From: Shinichiro Kawasaki @ 2023-11-16 11:00 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: Christoph Hellwig, Keith Busch, Sagi Grimberg,
	linux-nvme@lists.infradead.org, Maurizio Lombardi

On Oct 20, 2023 / 07:06, Hannes Reinecke wrote:
> The TLS handshake timeout work item should always be
> initialized to avoid a crash when cancelling the workqueue.
> 
> Fixes: 675b453e0241 ("nvmet-tcp: enable TLS handshake upcall")
> Suggested-by: Maurizio Lombardi <mlombard@redhat.com>
> Signed-off-by: Hannes Reinecke <hare@suse.de>

I also confirmed that this patch fixes blktests nvme test group failures
observed with tcp transport.

Tested-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCHv3] nvmet-tcp: always initialize tls_handshake_tmo_work
  2023-10-20  5:06 [PATCHv3] nvmet-tcp: always initialize tls_handshake_tmo_work Hannes Reinecke
  2023-11-10 11:40 ` Yi Zhang
  2023-11-16 11:00 ` Shinichiro Kawasaki
@ 2023-11-20 10:40 ` Sagi Grimberg
  2023-11-20 17:25 ` Keith Busch
  3 siblings, 0 replies; 5+ messages in thread
From: Sagi Grimberg @ 2023-11-20 10:40 UTC (permalink / raw)
  To: Hannes Reinecke, Christoph Hellwig
  Cc: Keith Busch, linux-nvme, Maurizio Lombardi

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCHv3] nvmet-tcp: always initialize tls_handshake_tmo_work
  2023-10-20  5:06 [PATCHv3] nvmet-tcp: always initialize tls_handshake_tmo_work Hannes Reinecke
                   ` (2 preceding siblings ...)
  2023-11-20 10:40 ` Sagi Grimberg
@ 2023-11-20 17:25 ` Keith Busch
  3 siblings, 0 replies; 5+ messages in thread
From: Keith Busch @ 2023-11-20 17:25 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: Christoph Hellwig, Sagi Grimberg, linux-nvme, Maurizio Lombardi

On Fri, Oct 20, 2023 at 07:06:06AM +0200, Hannes Reinecke wrote:
> The TLS handshake timeout work item should always be
> initialized to avoid a crash when cancelling the workqueue.
> 
> Fixes: 675b453e0241 ("nvmet-tcp: enable TLS handshake upcall")
> Suggested-by: Maurizio Lombardi <mlombard@redhat.com>
> Signed-off-by: Hannes Reinecke <hare@suse.de>

Applied for nvme-6.7, thanks!


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-11-20 17:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-20  5:06 [PATCHv3] nvmet-tcp: always initialize tls_handshake_tmo_work Hannes Reinecke
2023-11-10 11:40 ` Yi Zhang
2023-11-16 11:00 ` Shinichiro Kawasaki
2023-11-20 10:40 ` Sagi Grimberg
2023-11-20 17:25 ` Keith Busch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox