iscsi: Handle spdk_get_pdu() failure in spdk_iscsi_execute()

Prepares spdk_iscsi_execute() to handle the case where
spdk_get_pdu() will return NULL in a future patch instead
of abort()'ing.

Change-Id: I8f7e46495db2c517970e7e5de6ace1b13159b42b
Signed-off-by: Lance Hartmann <lance.hartmann@oracle.com>
Reviewed-on: https://review.gerrithub.io/403883
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Lance Hartmann 2018-03-14 14:35:17 -04:00 committed by Jim Harris
parent b080d5a875
commit 3dcd1942ff

View File

@ -4404,6 +4404,9 @@ spdk_iscsi_execute(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu)
* */ * */
if (!conn->full_feature && conn->state == ISCSI_CONN_STATE_RUNNING) { if (!conn->full_feature && conn->state == ISCSI_CONN_STATE_RUNNING) {
rsp_pdu = spdk_get_pdu(); rsp_pdu = spdk_get_pdu();
if (rsp_pdu == NULL) {
return SPDK_ISCSI_CONNECTION_FATAL;
}
spdk_init_login_reject_response(pdu, rsp_pdu); spdk_init_login_reject_response(pdu, rsp_pdu);
spdk_iscsi_conn_write_pdu(conn, rsp_pdu); spdk_iscsi_conn_write_pdu(conn, rsp_pdu);
SPDK_ERRLOG("Received opcode %d in login phase\n", opcode); SPDK_ERRLOG("Received opcode %d in login phase\n", opcode);