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 <pl@kamp.de>
This commit is contained in:
Peter Lieven
2015-03-19 12:37:54 +01:00
parent 373d5883d4
commit ea2bcfd308

View File

@@ -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);
}