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: Changpeng Liu <changpeng.liu@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/449717 Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: yidong0635 <dongx.yi@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
e87e8263df
commit
790c47d479
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user