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:
@@ -49,19 +49,19 @@ iscsi_scsi_response_cb(struct iscsi_context *iscsi, int status,
|
|||||||
{
|
{
|
||||||
struct iscsi_scsi_cbdata *scsi_cbdata =
|
struct iscsi_scsi_cbdata *scsi_cbdata =
|
||||||
(struct iscsi_scsi_cbdata *)private_data;
|
(struct iscsi_scsi_cbdata *)private_data;
|
||||||
struct scsi_task *task = command_data;
|
|
||||||
|
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case SCSI_STATUS_RESERVATION_CONFLICT:
|
case SCSI_STATUS_RESERVATION_CONFLICT:
|
||||||
case SCSI_STATUS_CHECK_CONDITION:
|
case SCSI_STATUS_CHECK_CONDITION:
|
||||||
case SCSI_STATUS_GOOD:
|
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);
|
scsi_cbdata->private_data);
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
iscsi_set_error(iscsi, "Cant handle scsi status %d yet.",
|
iscsi_set_error(iscsi, "Cant handle scsi status %d yet.",
|
||||||
status);
|
status);
|
||||||
scsi_cbdata->callback(iscsi, SCSI_STATUS_ERROR, task,
|
scsi_cbdata->callback(iscsi, SCSI_STATUS_ERROR, scsi_cbdata->task,
|
||||||
scsi_cbdata->private_data);
|
scsi_cbdata->private_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user