Commit 34cb6a15 authored by Naresh Gottumukkala's avatar Naresh Gottumukkala Committed by Jim Harris
Browse files

nvmf/fc: Validate connection and QPair state.



When ever command is recieved, validate connection and qpair state
before accepting the command.

Signed-off-by: default avatarNaresh Gottumukkala <raju.gottumukkala@broadcom.com>
Change-Id: I4636b98ab24de9be0fa7fd727c8b80f16922eb2b
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5709


Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent e89d9af0
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -1356,11 +1356,20 @@ nvmf_fc_hwqp_handle_request(struct spdk_nvmf_fc_hwqp *hwqp, struct spdk_nvmf_fc_

	/* If association/connection is being deleted - return */
	if (fc_conn->fc_assoc->assoc_state != SPDK_NVMF_FC_OBJECT_CREATED) {
		SPDK_ERRLOG("Association state not valid\n");
		SPDK_ERRLOG("Association %ld state = %d not valid\n",
			    fc_conn->fc_assoc->assoc_id, fc_conn->fc_assoc->assoc_state);
		return -EACCES;
	}

	if (fc_conn->qpair.state == SPDK_NVMF_QPAIR_ERROR) {
	if (fc_conn->conn_state != SPDK_NVMF_FC_OBJECT_CREATED) {
		SPDK_ERRLOG("Connection %ld state = %d not valid\n",
			    rqst_conn_id, fc_conn->conn_state);
		return -EACCES;
	}

	if (fc_conn->qpair.state != SPDK_NVMF_QPAIR_ACTIVE) {
		SPDK_ERRLOG("Connection %ld qpair state = %d not valid\n",
			    rqst_conn_id, fc_conn->qpair.state);
		return -EACCES;
	}