From 024f7dc94e5793dff3786d5e5ce1ed9323230d15 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Sat, 16 Apr 2011 13:51:32 +1000 Subject: [PATCH] In iscsi_scsi_response_cb() dont pick task up from the argument, since this callback can be invoked from places where we dont have/know the task strucutre and it is thus NULL. Instead pick it up from scsi_cbstruct. This prevents a SEGV when processing REJECT to SCSI commands. (the scsi command callback dereferences the task pointer) --- lib/scsi-command.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/scsi-command.c b/lib/scsi-command.c index 5eaebc7..b0a5e9c 100644 --- a/lib/scsi-command.c +++ b/lib/scsi-command.c @@ -49,19 +49,19 @@ iscsi_scsi_response_cb(struct iscsi_context *iscsi, int status, { struct iscsi_scsi_cbdata *scsi_cbdata = (struct iscsi_scsi_cbdata *)private_data; - struct scsi_task *task = command_data; switch (status) { case SCSI_STATUS_RESERVATION_CONFLICT: case SCSI_STATUS_CHECK_CONDITION: case SCSI_STATUS_GOOD: - scsi_cbdata->callback(iscsi, status, task, + case SCSI_STATUS_ERROR: + scsi_cbdata->callback(iscsi, status, scsi_cbdata->task, scsi_cbdata->private_data); return; default: iscsi_set_error(iscsi, "Cant handle scsi status %d yet.", status); - scsi_cbdata->callback(iscsi, SCSI_STATUS_ERROR, task, + scsi_cbdata->callback(iscsi, SCSI_STATUS_ERROR, scsi_cbdata->task, scsi_cbdata->private_data); } }