lib/iscsi: Fix NULL pointer access for logout with close connection
conn->sess->session_type must be accessed when conn->sess is not NULL. Signed-off-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Change-Id: I3d41443352b65ee5ef4cc1f0d152b9e3221975c9 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/471877 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Ziye Yang <ziye.yang@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
parent
71f63bb7d9
commit
9c3c488e0c
@ -2483,12 +2483,12 @@ iscsi_pdu_hdr_op_logout(struct spdk_iscsi_conn *conn, struct spdk_iscsi_pdu *pdu
|
||||
SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "reason=%d, ITT=%x, cid=%d\n",
|
||||
reqh->reason, task_tag, cid);
|
||||
|
||||
if (reqh->reason != 0 && conn->sess->session_type == SESSION_TYPE_DISCOVERY) {
|
||||
SPDK_ERRLOG("only logout with close the session reason can be in discovery session");
|
||||
return SPDK_ISCSI_CONNECTION_FATAL;
|
||||
}
|
||||
|
||||
if (conn->sess != NULL) {
|
||||
if (reqh->reason != 0 && conn->sess->session_type == SESSION_TYPE_DISCOVERY) {
|
||||
SPDK_ERRLOG("only logout with close the session reason can be in discovery session\n");
|
||||
return SPDK_ISCSI_CONNECTION_FATAL;
|
||||
}
|
||||
|
||||
SPDK_DEBUGLOG(SPDK_LOG_ISCSI,
|
||||
"CmdSN=%u, ExpStatSN=%u, StatSN=%u, ExpCmdSN=%u, MaxCmdSN=%u\n",
|
||||
pdu->cmd_sn, ExpStatSN, conn->StatSN,
|
||||
|
Loading…
Reference in New Issue
Block a user