iscsi: Change protcol error from drop conn to reject

In iSCSI specification RFC7143, there is the following description
in the section 7.13:

  All violations of iSCSI PDU exchange sequences specified in this
  document are also protocol errors.

Any protocol error should be handled as iSCSI Reject response whose
the reject reason is Protocol Error.

However current implementation handles a minor PDU error as Drop
connection. This is too severe and change the code from Drop
connection to Reject response.

This issue was detected by libiscsi test suite.

Change-Id: Ie85c56f5dd523445530ec1ff71eda4f594ab73a0
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/389941
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
Shuhei Matsumoto 2017-12-05 15:44:10 +09:00 committed by Jim Harris
parent 50ec73894c
commit 02814cd34b

View File

@ -3003,9 +3003,15 @@ spdk_iscsi_op_scsi(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
}
if (pdu->data_segment_len > transfer_len) {
SPDK_ERRLOG("data segment len > task transfer len\n");
SPDK_ERRLOG("data segment len(=%d) > task transfer len(=%d)\n",
(int)pdu->data_segment_len, transfer_len);
spdk_iscsi_task_put(task);
return SPDK_ISCSI_CONNECTION_FATAL;
rc = spdk_iscsi_reject(conn, pdu,
ISCSI_REASON_PROTOCOL_ERROR);
if (rc < 0) {
SPDK_ERRLOG("iscsi_reject() failed\n");
}
return rc;
}
/* check the ImmediateData and also pdu->data_segment_len */