Skip to content

Commit

Permalink
[SCSI] fix panic when ejecting ieee1394 ipod
Browse files Browse the repository at this point in the history
The scsi_library routines don't correctly set DMA_NONE when
req->data_len is zero (instead they check the command type first, so
if it's write, we end up with req->data_len == 0 and direction as
DMA_TO_DEVICE which confuses some drivers)

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
  • Loading branch information
Jens Axboe authored and James Bottomley committed Dec 9, 2005
1 parent 8563167 commit a8c730e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/scsi/scsi_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1215,12 +1215,12 @@ static int scsi_prep_fn(struct request_queue *q, struct request *req)
} else {
memcpy(cmd->cmnd, req->cmd, sizeof(cmd->cmnd));
cmd->cmd_len = req->cmd_len;
if (rq_data_dir(req) == WRITE)
if (!req->data_len)
cmd->sc_data_direction = DMA_NONE;
else if (rq_data_dir(req) == WRITE)
cmd->sc_data_direction = DMA_TO_DEVICE;
else if (req->data_len)
cmd->sc_data_direction = DMA_FROM_DEVICE;
else
cmd->sc_data_direction = DMA_NONE;
cmd->sc_data_direction = DMA_FROM_DEVICE;

cmd->transfersize = req->data_len;
cmd->allowed = 3;
Expand Down

0 comments on commit a8c730e

Please sign in to comment.