diff options
| author | Linus Torvalds <torvalds@home.osdl.org> | 2004-01-19 07:29:44 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.osdl.org> | 2004-01-19 07:29:44 -0800 |
| commit | 4d53a003f12e93c181dff573ea866a912e758b7c (patch) | |
| tree | 263be30745031e1a2a243b5b5ffdf72be993f855 | |
| parent | d03652518e6fcef7157fd431e0e4370e11957125 (diff) | |
Make sure we don't access "cmd" in ide-scsi after having
started the command - it may not exist any more.
In particular, load the host early in order to do proper
locking without having to access the command structure later.
Noted by Andries Brouwer.
| -rw-r--r-- | drivers/scsi/ide-scsi.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c index 90b624748f1a..0951c089df3d 100644 --- a/drivers/scsi/ide-scsi.c +++ b/drivers/scsi/ide-scsi.c @@ -788,7 +788,8 @@ static inline int should_transform(ide_drive_t *drive, Scsi_Cmnd *cmd) static int idescsi_queue (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *)) { - idescsi_scsi_t *scsi = scsihost_to_idescsi(cmd->device->host); + struct Scsi_Host *host = cmd->device->host; + idescsi_scsi_t *scsi = scsihost_to_idescsi(host); ide_drive_t *drive = scsi->drive; struct request *rq = NULL; idescsi_pc_t *pc = NULL; @@ -839,9 +840,9 @@ static int idescsi_queue (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *)) rq->special = (char *) pc; rq->bio = idescsi_dma_bio (drive, pc); rq->flags = REQ_SPECIAL; - spin_unlock_irq(cmd->device->host->host_lock); + spin_unlock_irq(host->host_lock); (void) ide_do_drive_cmd (drive, rq, ide_end); - spin_lock_irq(cmd->device->host->host_lock); + spin_lock_irq(host->host_lock); return 0; abort: if (pc) kfree (pc); |
