Commit 790c47d4 authored by Changpeng Liu's avatar Changpeng Liu Committed by Jim Harris
Browse files

iscsi: fix up segment fault due to failed initialization



My iSCSI target reported segment fault after memory allocation
failure, and add the addtional check here can fix the issue.

Change-Id: Iee3e497d7028fbface6d110c78e73965ef0f178b
Signed-off-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/449717


Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avataryidong0635 <dongx.yi@intel.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent e87e8263
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ free_conn(struct spdk_iscsi_conn *conn)
static struct spdk_iscsi_conn *
find_iscsi_connection_by_id(int cid)
{
	if (g_conns_array[cid].is_valid == 1) {
	if (g_conns_array != MAP_FAILED && g_conns_array[cid].is_valid == 1) {
		return &g_conns_array[cid];
	} else {
		return NULL;
+1 −1
Original line number Diff line number Diff line
@@ -257,7 +257,7 @@ iscsi_initialize_all_pools(void)
static void
iscsi_check_pool(struct spdk_mempool *pool, size_t count)
{
	if (spdk_mempool_count(pool) != count) {
	if (pool && spdk_mempool_count(pool) != count) {
		SPDK_ERRLOG("spdk_mempool_count(%s) == %zu, should be %zu\n",
			    spdk_mempool_get_name(pool), spdk_mempool_count(pool), count);
	}