From: Guixin Liu <kanie@linux.alibaba.com>
To: Keith Busch <kbusch@kernel.org>, Jens Axboe <axboe@kernel.dk>,
Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>,
Nilay Shroff <nilay@linux.ibm.com>,
Daniel Wagner <dwagner@suse.de>, Hannes Reinecke <hare@suse.de>
Cc: linux-nvme@lists.infradead.org
Subject: [PATCH 2/4] nvmet: read CRTO from the capability register
Date: Wed, 2 Dec 2026 11:47:05 +0800 [thread overview]
Message-ID: <20261202034707.3844378-3-kanie@linux.alibaba.com> (raw)
In-Reply-To: <20261202034707.3844378-1-kanie@linux.alibaba.com>
The CRTO property reports the controller ready timeout, which lives in
the CAP register. nvmet_execute_prop_get() extracts it from CSTS
instead, where only the low bits are defined, so the property always
reads zero. Any host or tool that reads CRTO directly then gets 0
rather than the advertised CAP.TO.
Read NVME_CAP_TIMEOUT() from ctrl->cap.
Fixes: 1e058089d28f5 ("nvmet: implement crto property")
Cc: stable@vger.kernel.org
Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
---
Reproduced in a QEMU/KVM guest with nvmet-tcp loopback by issuing a
fabrics Property Get for CRTO (offset 0x68) and CAP via
NVME_IOCTL_ADMIN_CMD. Unpatched: CRTO reads 0 while CAP.TO is 15.
Patched: CRTO reads 15, matching CAP.TO. No injection needed.
drivers/nvme/target/fabrics-cmd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/nvme/target/fabrics-cmd.c b/drivers/nvme/target/fabrics-cmd.c
index 6f0fc695e649..35d8c2abfcaf 100644
--- a/drivers/nvme/target/fabrics-cmd.c
+++ b/drivers/nvme/target/fabrics-cmd.c
@@ -69,7 +69,7 @@ static void nvmet_execute_prop_get(struct nvmet_req *req)
val = ctrl->csts;
break;
case NVME_REG_CRTO:
- val = NVME_CAP_TIMEOUT(ctrl->csts);
+ val = NVME_CAP_TIMEOUT(ctrl->cap);
break;
default:
status = NVME_SC_INVALID_FIELD | NVME_STATUS_DNR;
--
2.43.7
next prev parent reply other threads:[~2026-12-02 3:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 3:47 [PATCH 0/4] nvme: target and host fixes from a drivers/nvme audit Guixin Liu
2026-12-02 3:47 ` [PATCH 1/4] nvme: mask the status before checking for Host Identifier Inconsistent Guixin Liu
2026-12-02 3:47 ` Guixin Liu [this message]
2026-12-02 3:47 ` [PATCH 3/4] nvmet: snapshot the passthru command before completing the request Guixin Liu
2026-12-02 3:59 ` sashiko-bot
2026-12-02 5:45 ` Guixin Liu
2026-12-02 3:47 ` [PATCH 4/4] nvmet-auth: select the configured DH group from the host's list Guixin Liu
2026-12-02 4:01 ` sashiko-bot
2026-12-02 5:49 ` Guixin Liu
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=20261202034707.3844378-3-kanie@linux.alibaba.com \
--to=kanie@linux.alibaba.com \
--cc=axboe@kernel.dk \
--cc=dwagner@suse.de \
--cc=hare@suse.de \
--cc=hch@lst.de \
--cc=kbusch@kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=nilay@linux.ibm.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 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.