From ea2bcfd3087ffa4542a87a96cca7d6e0e6bcd695 Mon Sep 17 00:00:00 2001 From: Peter Lieven Date: Thu, 19 Mar 2015 12:37:54 +0100 Subject: [PATCH] init: fix segfault in iscsi_destroy_context observed when iscsi_destroy_context is called while a iscsi NOP out is in flight. Signed-off-by: Peter Lieven --- lib/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/init.c b/lib/init.c index 395d317..afe88e7 100644 --- a/lib/init.c +++ b/lib/init.c @@ -295,7 +295,7 @@ iscsi_destroy_context(struct iscsi_context *iscsi) /* If an error happened during connect/login, we don't want to call any of the callbacks. */ - if (iscsi->is_loggedin) { + if (iscsi->is_loggedin && pdu->callback != NULL) { pdu->callback(iscsi, SCSI_STATUS_CANCELLED, NULL, pdu->private_data); } @@ -307,7 +307,7 @@ iscsi_destroy_context(struct iscsi_context *iscsi) /* If an error happened during connect/login, we don't want to call any of the callbacks. */ - if (iscsi->is_loggedin) { + if (iscsi->is_loggedin && pdu->callback != NULL) { pdu->callback(iscsi, SCSI_STATUS_CANCELLED, NULL, pdu->private_data); }