[PATCH 5.10.y] nvme-tcp: fix error codes in nvme_tcp_setup_ctrl()

Karl Mehltretter kmehltretter at gmail.com
Wed Oct 28 20:13:52 PDT 2026


From: Dan Carpenter <dan.carpenter at oracle.com>

commit 522af60cb2f8e3658bda1902fb7f200dcf888a5c upstream.

These error paths currently return success but they should return
-EOPNOTSUPP.

Fixes: 73ffcefcfca0 ("nvme-tcp: check sgl supported by target")
Fixes: 3f2304f8c6d6 ("nvme-tcp: add NVMe over TCP host driver")
Signed-off-by: Dan Carpenter <dan.carpenter at oracle.com>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni at wdc.com>
Signed-off-by: Christoph Hellwig <hch at lst.de>
[ Karl Mehltretter: Omit the SGL-check hunk because 5.10.y lacks
  73ffcefcfca0 ("nvme-tcp: check sgl supported by target"). ]
Assisted-by: LLM
Signed-off-by: Karl Mehltretter <kmehltretter at gmail.com>
---
The fix is already in 5.15 and newer.

Tested on the 5.10.273 review queue (6aa0165f18f12) in arm64 QEMU,
using a loopback NVMe/TCP target stub reporting icdoff = 1. Without the
fix, the connection write succeeds and deleting the remaining controller
oopses. With the fix, the write fails with -EOPNOTSUPP and no controller
remains in sysfs.

 drivers/nvme/host/tcp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index 9e1c45d7cc999..6c52e7fc2bf46 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -2116,6 +2116,7 @@ static int nvme_tcp_setup_ctrl(struct nvme_ctrl *ctrl, bool new)
 		return ret;
 
 	if (ctrl->icdoff) {
+		ret = -EOPNOTSUPP;
 		dev_err(ctrl->device, "icdoff is not supported!\n");
 		goto destroy_admin;
 	}
-- 
2.50.1



More information about the Linux-nvme mailing list