nvmf/fc: Validate connection and QPair state.

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

Signed-off-by: Naresh 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: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Naresh Gottumukkala 2020-12-28 07:06:42 +00:00 committed by Jim Harris
parent e89d9af092
commit 34cb6a1578

View File

@ -1355,12 +1355,21 @@ 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");
if (fc_conn->fc_assoc->assoc_state != SPDK_NVMF_FC_OBJECT_CREATED) {
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;
}