nvme-tcp: fix error codes in nvme_tcp_setup_ctrl()
Subsystems (2)
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.
[ Karl Mehltretter: Omit the SGL-check hunk because 5.10.y lacks
73ffcefcfca0 ("nvme-tcp: check sgl supported by target"). ]
---
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
@@ -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
Quoted 2 lines
These error paths currently return success but they should return
-EOPNOTSUPP.
Queued for 5.10, thanks.
Signature · 2 lines
Thanks, Sasha