Skip to content

Commit

Permalink
[SCSI] fix OOPS due to clearing eh_action prior to aborting eh command
Browse files Browse the repository at this point in the history
The eh_action semaphore in scsi_eh_send_command is cleared after a
command timeout.  The command is subsequently aborted and the abort
will try to call scsi_done() on it.  Unfortunately, the scsi_eh_done()
routine unconditinally completes the semaphore (which is now null).
Fix this race by makiong the scsi_eh_done() routine check that the
semaphore is non null before completing it (mirroring the ordinary
command done/timeout logic).

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
  • Loading branch information
Michael Reed authored and James Bottomley committed Dec 8, 2005
1 parent f035330 commit 8563167
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/scsi/scsi_error.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,10 +422,15 @@ static int scsi_eh_completed_normally(struct scsi_cmnd *scmd)
**/
static void scsi_eh_done(struct scsi_cmnd *scmd)
{
struct completion *eh_action;

SCSI_LOG_ERROR_RECOVERY(3,
printk("%s scmd: %p result: %x\n",
__FUNCTION__, scmd, scmd->result));
complete(scmd->device->host->eh_action);

eh_action = scmd->device->host->eh_action;
if (eh_action)
complete(eh_action);
}

/**
Expand Down

0 comments on commit 8563167

Please sign in to comment.