nvme-tcp: return -EPROTO for a C2HData on a write

The direction check in nvme_tcp_handle_c2h_data() returns -EIO.  A
C2HData PDU naming a command that did not ask for data is a protocol
violation, and the check that rejects a PDU on those grounds a few
lines below it - SUCCESS set without LAST - returns -EPROTO.

No caller distinguishes the two, so this changes the error code alone.

Suggested-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Yehyeong Lee <yhlee@isslab.korea.ac.kr>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Keith Busch <kbusch@kernel.org>
This commit is contained in:
Yehyeong Lee 2026-08-23 16:46:16 +09:00 committed by Keith Busch
parent 59fe1cbc57
commit df7197ebc7

View File

@ -688,7 +688,7 @@ static int nvme_tcp_handle_c2h_data(struct nvme_tcp_queue *queue,
dev_err(queue->ctrl->ctrl.device,
"queue %d tag %#x unexpected data for a write\n",
nvme_tcp_queue_id(queue), rq->tag);
return -EIO;
return -EPROTO;
}
req = blk_mq_rq_to_pdu(rq);