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 2/3] nvme-fabrics: bound keep_alive_tmo to avoid overflow
Date: Fri, 13 Nov 2026 22:20:01 +0530 [thread overview]
Message-ID: <20261113165002.12536-3-marting@netapp.com> (raw)
In-Reply-To: <20261113165002.12536-1-marting@netapp.com>
keep_alive_tmo (kato) is only checked for being negative, yet it is sent
to the controller as "kato * 1000" ms and used as "kato * HZ" jiffies for
the keep-alive timer; a large value overflows both.
Reject values above INT_MAX / 1000 so the millisecond form "kato * 1000"
stays within 32 bits. kato is unsigned, so the "kato * HZ" jiffies form
cannot wrap even on architectures where HZ exceeds 1000 (e.g. alpha).
This mirrors the target, which caps kato via NVMET_MAX_KATO.
Signed-off-by: Martin George <marting@netapp.com>
Reviewed-by: Laurence Oberman <loberman@redhat.com>
---
drivers/nvme/host/fabrics.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
index 25029978b978..b4ca0f9fd703 100644
--- a/drivers/nvme/host/fabrics.c
+++ b/drivers/nvme/host/fabrics.c
@@ -837,7 +837,7 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
goto out;
}
- if (token < 0) {
+ if (token < 0 || token > INT_MAX / 1000) {
pr_err("Invalid keep_alive_tmo %d\n", token);
ret = -EINVAL;
goto out;
--
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 ` Martin George [this message]
2026-11-20 17:55 ` [PATCH v2 2/3] nvme-fabrics: bound keep_alive_tmo " Christoph Hellwig
2026-11-13 16:50 ` [PATCH v2 3/3] nvme-fabrics: bound fast_io_fail_tmo " Martin George
2026-11-20 17:56 ` 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-3-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