Linux Documentation
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Yingjie Wang <1075151112@qq.com>, linux-nvme@lists.infradead.org
Cc: kbusch@kernel.org, axboe@kernel.dk, hch@lst.de, sagi@grimberg.me,
	kch@nvidia.com, corbet@lwn.net, skhan@linuxfoundation.org,
	rdunlap@infradead.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/2] nvme-tcp: validate the TLS handshake timeout
Date: Wed, 28 Oct 2026 08:47:38 +0100	[thread overview]
Message-ID: <f424d050-fa3f-4ad6-b7ca-92acff3b21dd@suse.de> (raw)
In-Reply-To: <tencent_02EC3FD2E750D09B95ACA70091EE65DE0906@qq.com>

On 10/27/26 1:13 PM, Yingjie Wang wrote:
> tls_handshake_timeout is writable but stored as a signed int. Multiplying
> the value by MSEC_PER_SEC and HZ therefore uses signed arithmetic.
> 
> With HZ=1000, setting it to 2147484 overflows both multiplications. If
> the handshake request is accepted and its completion remains pending,
> schedule_timeout() reports a wrong timeout value with a stack dump and
> returns zero. The handshake then fails immediately with -ETIMEDOUT,
> while the handshake agent was given about 24.9 days. Negative values
> such as -1 have the same kernel-side effect.
> 
> Store the parameter as an unsigned int and reject values that cannot be
> represented both by tls_handshake_args::ta_timeout_ms and by a safe
> jiffies delay. Take one snapshot so a concurrent parameter update cannot
> give the handshake agent and completion wait different timeouts.
> Document the accepted range for built-in use.
> 
> wait_for_completion_interruptible_timeout() returns the remaining
> jiffies as a long after a successful completion. Keep that result in a
> long because an accepted timeout can exceed INT_MAX jiffies on 64-bit
> systems.
> 
> Negative and oversized values now fail with -EINVAL. Keep zero valid,
> preserving the existing immediate-timeout behavior.
> 
> Fixes: be8e82caa685 ("nvme-tcp: enable TLS handshake upcall")
> Cc: stable@vger.kernel.org
> Signed-off-by: Yingjie Wang <1075151112@qq.com>
> ---
>   .../admin-guide/kernel-parameters.txt         |  5 +++
>   drivers/nvme/host/tcp.c                       | 34 ++++++++++++++-----
>   2 files changed, 31 insertions(+), 8 deletions(-)
> 
Reviewed-by: Hannes Reinecke <hare@kernel.org>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                  Kernel Storage Architect
hare@suse.de                                +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich

      parent reply	other threads:[~2026-10-28  7:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1793103202.git.1075151112@qq.com>
2026-10-27 12:13 ` [PATCH v2 1/2] nvmet-tcp: validate the TLS handshake timeout Yingjie Wang
2026-10-28  7:46   ` Hannes Reinecke
2026-10-27 12:13 ` [PATCH v2 2/2] nvme-tcp: " Yingjie Wang
2026-10-27 15:13   ` Randy Dunlap
2026-10-28  7:47   ` Hannes Reinecke [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f424d050-fa3f-4ad6-b7ca-92acff3b21dd@suse.de \
    --to=hare@suse.de \
    --cc=1075151112@qq.com \
    --cc=axboe@kernel.dk \
    --cc=corbet@lwn.net \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=kch@nvidia.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=rdunlap@infradead.org \
    --cc=sagi@grimberg.me \
    --cc=skhan@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox