[PATCH 14/22] ncr5380: Add MAX_LUN limit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The driver has a limit of eight LUs because of the byte-sized bitfield
that is used for busy flags. Reject commands with LUN > 7.

Signed-off-by: Finn Thain <fthain@xxxxxxxxxxxxxxxxxxx>

---
 drivers/scsi/NCR5380.c |    6 ++++++
 drivers/scsi/NCR5380.h |    2 ++
 2 files changed, 8 insertions(+)

Index: linux/drivers/scsi/NCR5380.c
===================================================================
--- linux.orig/drivers/scsi/NCR5380.c	2016-03-14 15:26:45.000000000 +1100
+++ linux/drivers/scsi/NCR5380.c	2016-03-14 15:26:48.000000000 +1100
@@ -661,6 +661,12 @@ static int NCR5380_queue_command(struct
 	}
 #endif /* (NDEBUG & NDEBUG_NO_WRITE) */
 
+	if (cmd->device->lun > MAX_LUN) {
+		cmd->result = DID_NO_CONNECT << 16;
+		cmd->scsi_done(cmd);
+		return 0;
+	}
+
 	cmd->result = 0;
 
 	if (!NCR5380_acquire_dma_irq(instance))
Index: linux/drivers/scsi/NCR5380.h
===================================================================
--- linux.orig/drivers/scsi/NCR5380.h	2016-03-14 15:26:45.000000000 +1100
+++ linux/drivers/scsi/NCR5380.h	2016-03-14 15:26:48.000000000 +1100
@@ -244,6 +244,8 @@ struct NCR5380_hostdata {
 
 #ifdef __KERNEL__
 
+#define MAX_LUN	7
+
 struct NCR5380_cmd {
 	struct list_head list;
 };


--
To unsubscribe from this list: 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



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux