Skip to contentSkip to conversation

2.5.60, cciss, fix array bounds overrun

PATCH New steve cameron 1 participant 1 message Feb 14, 2003 Block layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 2.5.60, cciss, fix array bounds overrun

Fix overrun if you have more than 16 attached tape drives + tape changers. Thanks to Mike Anderson for pointing this out.

-- steve

drivers/block/cciss_scsi.c renamed from drivers/block/cciss_scsi.c~currentsd_overrun +6 -0
@@ -1106,6 +1106,12 @@ cciss_update_non_disk_devices(int cntl_n
 		{
 		  case 0x01: /* sequential access, (tape) */
 		  case 0x08: /* medium changer */
+			if (ncurrent >= CCISS_MAX_SCSI_DEVS_PER_HBA) {
+				printk(KERN_INFO "cciss%d: %s ignored, "
+					"too many devices.\n", cntl_num,
+					DEVICETYPE(devtype));
+				break;
+			}
 			memcpy(&currentsd[ncurrent].scsi3addr[0], 
 				&scsi3addr[0], 8);
 			currentsd[ncurrent].devtype = devtype;

_