[PATCH] nvme-fc: initialize result on transport failure

Andrew Stellman bugs at stellman-greene.com
Sun Nov 29 05:52:53 PST 2026


From: Andrew Stellman <astellman at stellman-greene.com>

nvme_fc_fcpio_done() declares result without an initializer. When a
command is aborted, it jumps to done without assigning result and
passes it to nvme_try_complete_req(). For a passthrough command, the
ioctl then copies that value to user space along with the host aborted
status.

Initialize result to zero. The success paths still assign it.

Tested on a mainline 7.4.0-rc4 snapshot in an arm64 QEMU guest with
CONFIG_INIT_STACK_NONE=y, CONFIG_KASAN=y and NVMe/FC loopback (fcloop).
Root gave other users read access to /dev/nvme0, and a non-root user
then sent Identify Controller with a 1500 ms timeout while fcloop
dropped the command. Without the patch the ioctl returned status 0x371
(host aborted) and a nonzero result, in two boots. With the patch the
result was 0 in one boot. Identify without a drop returned status 0 and
result 0 in every boot.

The issue was found by Claude Opus 5.5 running Quality Playbook, an
LLM-driven code review tool:
https://github.com/andrewstellman/quality-playbook
The fix was drafted with OpenAI GPT-6 (Codex) and this changelog with
Claude Opus 5.5, and both were reviewed by me.

Fixes: 27fa9bc54541 ("nvme: split nvme status from block req->errors")
Signed-off-by: Andrew Stellman <astellman at stellman-greene.com>
---
A reproducer is available on request.

 drivers/nvme/host/fc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index 2cbd744ffd22a..978ec029ac950 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -1902,7 +1902,7 @@ nvme_fc_fcpio_done(struct nvmefc_fcp_req *req)
 	struct nvme_completion *cqe = &op->rsp_iu.cqe;
 	struct nvme_command *sqe = &op->cmd_iu.sqe;
 	__le16 status = cpu_to_le16(NVME_SC_SUCCESS << 1);
-	union nvme_result result;
+	union nvme_result result = {};
 	bool terminate_assoc = true;
 	int opstate;
 
-- 
2.53.0




More information about the Linux-nvme mailing list