[PATCH 1/2] nvmet-tcp: validate the TLS handshake timeout
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Tue Oct 27 02:50:23 PDT 2026
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 at 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
More information about the Linux-nvme
mailing list