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)
This commit is contained in:
Ronnie Sahlberg
2011-04-16 13:51:32 +10:00
parent 49dd0fb8b3
commit 024f7dc94e

View File

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