From dfe5d837439a4ae4448192879c87b6dc9fa95b62 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Thu, 22 Sep 2016 15:52:03 -0700 Subject: [PATCH] iscsi: ensure we have a conn->sess before trying to stop a poller There are some error paths that can get to spdk_iscsi_conn_stop_poller() before the conn's session is set. So check whether the session is NULL before trying to check its session type. Signed-off-by: Jim Harris Change-Id: I352a2aa513541ba630ace368137433e509700e32 --- lib/iscsi/conn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/iscsi/conn.c b/lib/iscsi/conn.c index f13eb0c4a..de887875b 100644 --- a/lib/iscsi/conn.c +++ b/lib/iscsi/conn.c @@ -678,7 +678,7 @@ spdk_iscsi_conn_stop_poller(struct spdk_iscsi_conn *conn, spdk_event_fn fn_after struct spdk_event *event; struct spdk_iscsi_tgt_node *target; - if (conn->sess->session_type == SESSION_TYPE_NORMAL) { + if (conn->sess != NULL && conn->sess->session_type == SESSION_TYPE_NORMAL) { target = conn->sess->target; pthread_mutex_lock(&target->mutex); target->num_active_conns--;