From: Martin George <martinus.gpy@gmail.com>
To: linux-nvme@lists.infradead.org, hch@lst.de
Cc: kbusch@kernel.org, sagi@grimberg.me
Subject: [PATCH 1/2] nvme-fabrics: bound reconnect_delay to avoid timer overflow
Date: Fri, 13 Nov 2026 15:39:50 +0530 [thread overview]
Message-ID: <20261113100951.17577-2-marting@netapp.com> (raw)
In-Reply-To: <20261113100951.17577-1-marting@netapp.com>
reconnect_delay is accepted up to INT_MAX, but every consumer computes
"reconnect_delay * HZ" in 32-bit (nvme-tcp, nvme-rdma, nvme-fc), so a
large value wraps into a short, bogus reconnect interval.
Reject values above INT_MAX / HZ in both the option parser and the
sysfs store.
Signed-off-by: Martin George <marting@netapp.com>
---
drivers/nvme/host/fabrics.c | 2 +-
drivers/nvme/host/sysfs.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
index c262538523fb..25029978b978 100644
--- a/drivers/nvme/host/fabrics.c
+++ b/drivers/nvme/host/fabrics.c
@@ -893,7 +893,7 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
ret = -EINVAL;
goto out;
}
- if (token <= 0) {
+ if (token <= 0 || token > INT_MAX / HZ) {
pr_err("Invalid reconnect_delay %d\n", token);
ret = -EINVAL;
goto out;
diff --git a/drivers/nvme/host/sysfs.c b/drivers/nvme/host/sysfs.c
index 9672ca3f74d2..8876d8db5401 100644
--- a/drivers/nvme/host/sysfs.c
+++ b/drivers/nvme/host/sysfs.c
@@ -632,7 +632,7 @@ static ssize_t nvme_ctrl_reconnect_delay_store(struct device *dev,
if (err)
return err;
- if (!v || v > INT_MAX)
+ if (!v || v > INT_MAX / HZ)
return -EINVAL;
ctrl->opts->reconnect_delay = v;
--
2.53.0
next prev parent reply other threads:[~2026-11-13 10:10 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 10:09 [PATCH 0/2] nvme-fabrics: bound reconnect_delay and keep_alive_tmo Martin George
2026-11-13 10:09 ` Martin George [this message]
2026-11-13 10:09 ` [PATCH 2/2] nvme-fabrics: bound keep_alive_tmo to avoid overflow Martin George
2026-11-13 13:01 ` [PATCH 0/2] nvme-fabrics: bound reconnect_delay and keep_alive_tmo Laurence Oberman
2026-11-13 15:16 ` Martin George
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=20261113100951.17577-2-marting@netapp.com \
--to=martinus.gpy@gmail.com \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=sagi@grimberg.me \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.