Hi,

The Scsi_Host structure max_lun field is the maximum allowed LUN plus 1. So
a LUN value is invalid if >= max_lun.

Signed-off-by: Mark Knibbs <ma...@clara.co.uk>

---
diff -upN linux-3.17/drivers/scsi/scsi_scan.c.orig 
linux-3.17/drivers/scsi/scsi_scan.c
--- linux-3.17/drivers/scsi/scsi_scan.c.orig    2014-10-05 20:23:04.000000000 
+0100
+++ linux-3.17/drivers/scsi/scsi_scan.c 2014-10-09 12:26:45.000000000 +0100
@@ -1704,7 +1704,7 @@ int scsi_scan_host_selected(struct Scsi_
 
        if (((channel != SCAN_WILD_CARD) && (channel > shost->max_channel)) ||
            ((id != SCAN_WILD_CARD) && (id >= shost->max_id)) ||
-           ((lun != SCAN_WILD_CARD) && (lun > shost->max_lun)))
+           ((lun != SCAN_WILD_CARD) && (lun >= shost->max_lun)))
                return -EINVAL;
 
        mutex_lock(&shost->scan_mutex);
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to