Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Yingjie Wang" <1075151112@qq.com>, linux-nvme@lists.infradead.org
Subject: Re: [PATCH 1/2] nvmet-tcp: validate the TLS handshake timeout
Date: Tue, 27 Oct 2026 09:50:23 +0000	[thread overview]
Message-ID: <sashiko-outbox-186336@kernel.org> (raw)
In-Reply-To: <tencent_39AF670751CA25EA49D4BFD8E76C509F5506@qq.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] nvmet-tcp: missing kernel-parameters.txt entry for tls_handshake_timeout
--

commit 88d44e836ad9d55aee22edbc907b852e3d9a66c6
Author: Yingjie Wang <1075151112@qq.com>

nvmet-tcp: validate the TLS handshake timeout

This commit changes the tls_handshake_timeout module parameter from a signed
int to an unsigned int and validates that configured values fit within both
tls_handshake_args::ta_timeout_ms and a valid jiffies delay. It also reads
the timeout once per handshake so the upcall and delayed work use the same
value.

> diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
> index c38ea3501ea5d..ba529cfc62577 100644
> --- a/drivers/nvme/target/tcp.c
> +++ b/drivers/nvme/target/tcp.c

[ ... ]

> @@ -76,8 +77,24 @@ MODULE_PARM_DESC(idle_poll_period_usecs,
>  /*
>   * TLS handshake timeout
>   */
> -static int tls_handshake_timeout = 10;
> -module_param(tls_handshake_timeout, int, 0644);
> +static unsigned int tls_handshake_timeout = 10;
> +
> +static int tls_handshake_timeout_set(const char *val,
> +				     const struct kernel_param *kp)
> +{
> +	return param_set_uint_minmax(val, kp, 0,
> +		min_t(unsigned long, UINT_MAX / MSEC_PER_SEC,
> +		      MAX_JIFFY_OFFSET / HZ));
> +}
> +
> +static const struct kernel_param_ops tls_handshake_timeout_ops = {
> +	.set = tls_handshake_timeout_set,
> +	.get = param_get_uint,
> +};
> +
> +module_param_cb(tls_handshake_timeout, &tls_handshake_timeout_ops,
> +		&tls_handshake_timeout, 0644);
> +__MODULE_PARM_TYPE(tls_handshake_timeout, "uint");

[Severity: Low]
In drivers/nvme/target/tcp.c, this changes the tls_handshake_timeout module
parameter definition from module_param() (int) to module_param_cb() (uint)
with range bounds checked by tls_handshake_timeout_set().

Since nvmet_tcp.tls_handshake_timeout is exposed on the kernel command line
when CONFIG_NVME_TARGET_TCP_TLS is enabled, should an entry also be added to
Documentation/admin-guide/kernel-parameters.txt documenting its format and
valid range?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/tencent_39AF670751CA25EA49D4BFD8E76C509F5506@qq.com?part=1


  reply	other threads:[~2026-10-27  9:50 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20261027093552.3934437-1-1075151112@qq.com>
2026-10-27  9:35 ` [PATCH 1/2] nvmet-tcp: validate the TLS handshake timeout Yingjie Wang
2026-10-27  9:50   ` sashiko-bot [this message]
2026-10-27  9:35 ` [PATCH 2/2] nvme-tcp: " Yingjie Wang
2026-10-27  9:47   ` sashiko-bot

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=sashiko-outbox-186336@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=1075151112@qq.com \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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