Skip to contentSkip to conversation

nvme-tcp: fix error codes in nvme_tcp_setup_ctrl()

PATCH Applied Karl Mehltretter 2 participants 2 messages Oct 29

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme-tcp: fix error codes in nvme_tcp_setup_ctrl()

From: Dan Carpenter <[email protected]>

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")

[ Karl Mehltretter: Omit the SGL-check hunk because 5.10.y lacks
73ffcefcfca0 ("nvme-tcp: check sgl supported by target"). ]

Assisted-by LLM

---
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(+)
drivers/nvme/host/tcp.c +1 -0
index 9e1c45d7cc999..6c52e7fc2bf46 100644
@@ -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;
 	}
Signature · 1 line
2.50.1
maintainer Applied
#1 lore raw
Quoted 2 lines

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

Queued for 5.10, thanks.

Signature · 2 lines
Thanks,
Sasha