From: Martin George <martinus.gpy@gmail.com>
To: linux-nvme@lists.infradead.org
Cc: hch@lst.de, kbusch@kernel.org, sagi@grimberg.me, loberman@redhat.com
Subject: [PATCH v2 3/3] nvme-fabrics: bound fast_io_fail_tmo to avoid overflow
Date: Fri, 13 Nov 2026 22:20:02 +0530 [thread overview]
Message-ID: <20261113165002.12536-4-marting@netapp.com> (raw)
In-Reply-To: <20261113165002.12536-1-marting@netapp.com>
fast_io_fail_tmo is accepted up to INT_MAX in both the option parser and
the sysfs store (only negatives are mapped to -1, "off"). It is then
scheduled as "fast_io_fail_tmo * HZ" in nvme_start_failfast_work(). As
the field is a signed int, a large value overflows that multiply and the
failfast work is queued with a bogus (effectively never-firing) delay.
Reject values above INT_MAX / HZ in both the parser and the sysfs store,
matching the reconnect_delay handling.
Suggested-by: Laurence Oberman <loberman@redhat.com>
Signed-off-by: Martin George <marting@netapp.com>
---
drivers/nvme/host/fabrics.c | 6 +++++-
drivers/nvme/host/sysfs.c | 2 ++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
index b4ca0f9fd703..7da6fc344985 100644
--- a/drivers/nvme/host/fabrics.c
+++ b/drivers/nvme/host/fabrics.c
@@ -862,7 +862,11 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
ret = -EINVAL;
goto out;
}
-
+ if (token > INT_MAX / HZ) {
+ pr_err("Invalid fast_io_fail_tmo %d\n", token);
+ ret = -EINVAL;
+ goto out;
+ }
if (token >= 0)
pr_warn("I/O fail on reconnect controller after %d sec\n",
token);
diff --git a/drivers/nvme/host/sysfs.c b/drivers/nvme/host/sysfs.c
index 8876d8db5401..dc59473f06f3 100644
--- a/drivers/nvme/host/sysfs.c
+++ b/drivers/nvme/host/sysfs.c
@@ -664,6 +664,8 @@ static ssize_t nvme_ctrl_fast_io_fail_tmo_store(struct device *dev,
if (fast_io_fail_tmo < 0)
opts->fast_io_fail_tmo = -1;
+ else if (fast_io_fail_tmo > INT_MAX / HZ)
+ return -EINVAL;
else
opts->fast_io_fail_tmo = fast_io_fail_tmo;
return count;
--
2.53.0
next prev parent reply other threads:[~2026-11-13 16:50 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 16:49 [PATCH v2 0/3] nvme-fabrics: bound reconnect_delay, kato and fast_io_fail_tmo Martin George
2026-11-13 16:50 ` [PATCH v2 1/3] nvme-fabrics: bound reconnect_delay to avoid overflow Martin George
2026-11-20 17:55 ` Christoph Hellwig
2026-11-13 16:50 ` [PATCH v2 2/3] nvme-fabrics: bound keep_alive_tmo " Martin George
2026-11-20 17:55 ` Christoph Hellwig
2026-11-13 16:50 ` Martin George [this message]
2026-11-20 17:56 ` [PATCH v2 3/3] nvme-fabrics: bound fast_io_fail_tmo " Christoph Hellwig
2026-11-13 16:57 ` [PATCH v2 0/3] nvme-fabrics: bound reconnect_delay, kato and fast_io_fail_tmo Laurence Oberman
2026-11-20 19:54 ` Keith Busch
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=20261113165002.12536-4-marting@netapp.com \
--to=martinus.gpy@gmail.com \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=loberman@redhat.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox