iscsi: Sequence error of Data-out PDU when ERL=0

SPDK drops the connection when it observes any sequence error of
Data-out PDU when ERL = 0. This is too severe and change dropping
the connection to Reject response.

This issue was detected by libiscsi test suite.

Change-Id: Ic8f50ce55c4e73c8517f726e8cf0e4ff8a0953df
Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-on: https://review.gerrithub.io/391158
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Shuhei Matsumoto 2017-12-11 16:20:58 +09:00 committed by Jim Harris
parent d1da24769f
commit 41bfe2049d

View File

@ -4113,6 +4113,7 @@ static int spdk_iscsi_op_data(struct spdk_iscsi_conn *conn,
int lun_i; int lun_i;
int F_bit; int F_bit;
int rc; int rc;
int reject_reason = ISCSI_REASON_INVALID_PDU_FIELD;
if (conn->sess->session_type == SESSION_TYPE_DISCOVERY) { if (conn->sess->session_type == SESSION_TYPE_DISCOVERY) {
SPDK_ERRLOG("ISCSI_OP_SCSI_DATAOUT not allowed in discovery session\n"); SPDK_ERRLOG("ISCSI_OP_SCSI_DATAOUT not allowed in discovery session\n");
@ -4151,7 +4152,8 @@ static int spdk_iscsi_op_data(struct spdk_iscsi_conn *conn,
if (conn->sess->ErrorRecoveryLevel >= 1) { if (conn->sess->ErrorRecoveryLevel >= 1) {
goto send_r2t_recovery_return; goto send_r2t_recovery_return;
} else { } else {
return SPDK_ISCSI_CONNECTION_FATAL; reject_reason = ISCSI_REASON_PROTOCOL_ERROR;
goto reject_return;
} }
} }
@ -4224,7 +4226,7 @@ send_r2t_recovery_return:
return rc; return rc;
reject_return: reject_return:
rc = spdk_iscsi_reject(conn, pdu, ISCSI_REASON_INVALID_PDU_FIELD); rc = spdk_iscsi_reject(conn, pdu, reject_reason);
if (rc < 0) { if (rc < 0) {
SPDK_ERRLOG("iscsi_reject() failed\n"); SPDK_ERRLOG("iscsi_reject() failed\n");
return SPDK_ISCSI_CONNECTION_FATAL; return SPDK_ISCSI_CONNECTION_FATAL;