[PATCH v2 2/5] nvmet: read CRTO from the capability register

Guixin Liu kanie at linux.alibaba.com
Wed Dec 2 03:58:53 PST 2026


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 at vger.kernel.org
Signed-off-by: Guixin Liu <kanie at 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




More information about the Linux-nvme mailing list