fix cases where 0 is passed as lun0, when we really want scsi_lun* drivers/scsi/scsi_scan.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) 1a13759a275199b7b6bb58dbddfee1e843b1ea2a diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c index abf4e42..1ccc4b1 100644 --- a/drivers/scsi/scsi_scan.c +++ b/drivers/scsi/scsi_scan.c @@ -1074,6 +1074,7 @@ static int scsi_report_lun_scan(struct s unsigned int retries; int result; struct scsi_lun *lunp, *lun_data; + struct scsi_lun lun0; u8 *data; struct scsi_sense_hdr sshdr; struct scsi_device *sdev; @@ -1092,8 +1093,9 @@ static int scsi_report_lun_scan(struct s if (bflags & BLIST_NOLUN) return 0; - if (!(sdev = scsi_device_lookup_by_target(starget, 0))) { - sdev = scsi_alloc_sdev(starget, 0, NULL); + int_to_scsilun(0, &lun0); + if (!(sdev = scsi_device_lookup_by_target(starget, &lun0))) { + sdev = scsi_alloc_sdev(starget, &lun0, NULL); if (!sdev) return 0; if (scsi_device_get(sdev)) @@ -1499,6 +1501,7 @@ struct scsi_device *scsi_get_host_dev(st { struct scsi_device *sdev = NULL; struct scsi_target *starget; + struct scsi_lun lun0; down(&shost->scan_mutex); if (!scsi_host_scan_allowed(shost)) @@ -1507,7 +1510,8 @@ struct scsi_device *scsi_get_host_dev(st if (!starget) goto out; - sdev = scsi_alloc_sdev(starget, 0, NULL); + int_to_scsilun(0, &lun0); + sdev = scsi_alloc_sdev(starget, &lun0, NULL); if (sdev) { sdev->sdev_gendev.parent = get_device(&starget->dev); sdev->borken = 0; - : send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html