test-tool: avoid use-after-free on iscsi_logout_sync
iscsi_logout_sync in lu_reset_simple will still refer to wtask in the case that we bail out due to reconnect failure. abort_simple would sometimes refer to wtask during iscsi_logout_sync, even if the test passed. Signed-off-by: Khazhismel Kumykov <khazhy@google.com>
This commit is contained in:
committed by
Ronnie Sahlberg
parent
88f67e8cf8
commit
2b9c928bce
@@ -199,10 +199,9 @@ test_async_abort_simple(void)
|
||||
CU_FAIL("unexpected WRITE/ABORT state");
|
||||
}
|
||||
|
||||
scsi_free_scsi_task(state.wtask);
|
||||
|
||||
/* Avoid that callbacks get invoked after this test finished */
|
||||
iscsi_logout_sync(sd->iscsi_ctx);
|
||||
iscsi_destroy_context(sd->iscsi_ctx);
|
||||
iscsi_logout_sync(sd->iscsi_ctx);
|
||||
iscsi_destroy_context(sd->iscsi_ctx);
|
||||
scsi_free_scsi_task(state.wtask);
|
||||
sd->iscsi_ctx = NULL;
|
||||
}
|
||||
|
||||
@@ -196,10 +196,10 @@ test_async_lu_reset_simple(void)
|
||||
}
|
||||
|
||||
out:
|
||||
scsi_free_scsi_task(state.wtask);
|
||||
|
||||
/* Avoid that callbacks get invoked after this test finished */
|
||||
iscsi_logout_sync(sd->iscsi_ctx);
|
||||
iscsi_destroy_context(sd->iscsi_ctx);
|
||||
iscsi_logout_sync(sd->iscsi_ctx);
|
||||
iscsi_destroy_context(sd->iscsi_ctx);
|
||||
scsi_free_scsi_task(state.wtask);
|
||||
sd->iscsi_ctx = NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user