Commit 02814cd3 authored by Shuhei Matsumoto's avatar Shuhei Matsumoto Committed by Jim Harris
Browse files

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: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/389941


Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
parent 50ec7389
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -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 */