Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

SCSI: Fix error handling when no ULD is attached

Commit 18a4d0a22ed6 ("[SCSI] Handle disk devices which can not process
medium access commands") introduced a bug in which we would attempt to
dereference the scsi driver even when the device had no ULD attached.

Ensure that a driver is registered and make the driver accessor function
more resilient to errors during device discovery.

Reported-by: Elric Fu <elricfu1@gmail.com>
Reported-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Martin K. Petersen and committed by
Linus Torvalds
919f797a bfecc60d

+4 -1
+1 -1
drivers/scsi/scsi_error.c
··· 835 835 836 836 scsi_eh_restore_cmnd(scmd, &ses); 837 837 838 - if (sdrv->eh_action) 838 + if (sdrv && sdrv->eh_action) 839 839 rtn = sdrv->eh_action(scmd, cmnd, cmnd_size, rtn); 840 840 841 841 return rtn;
+3
include/scsi/scsi_cmnd.h
··· 134 134 135 135 static inline struct scsi_driver *scsi_cmd_to_driver(struct scsi_cmnd *cmd) 136 136 { 137 + if (!cmd->request->rq_disk) 138 + return NULL; 139 + 137 140 return *(struct scsi_driver **)cmd->request->rq_disk->private_data; 138 141 } 139 142