Skip to contentSkip to conversation

scsi: 53c700: Fix hostdata[] size on 64-bit

PATCH Applied Geert Uytterhoeven 2 participants 2 messages Nov 23 – Nov 26

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: 53c700: Fix hostdata[] size on 64-bit

From: Geert Uytterhoeven <[email protected]>

NCR_700_detect() allocates four bytes for a single-entry hostdata array, to store the NCR_700_Host_Parameters pointer. However, hostdata is an array of unsigned longs, thus storing a pointer or unsigned long causes a buffer overflow on 64-bit platforms.

Fixes 1da177e4c3f41524 ("Linux-2.6.12-rc2")

---
Compile-tested only.

CONFIG_SCSI_LASI700 is used on PA-RISC 64-bit, CONFIG_SCSI_SIM710 might be used on Alpha with EISA.

---
 drivers/scsi/53c700.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/53c700.c +1 -1
index eb3a69dff1e72642..7236f9bfa0fe302f 100644
@@ -341,7 +341,7 @@ NCR_700_detect(struct scsi_host_template *tpnt,
 	if(tpnt->proc_name == NULL)
 		tpnt->proc_name = "53c700";
 
-	host = scsi_host_alloc(tpnt, 4);
+	host = scsi_host_alloc(tpnt, sizeof(unsigned long));
 	if (!host)
 		return NULL;
 	memset(hostdata->slots, 0, sizeof(struct NCR_700_command_slot)
Signature · 1 line
2.43.0
maintainer Applied
#1 lore raw

Geert,

Quoted 4 lines

NCR_700_detect() allocates four bytes for a single-entry hostdata array, to store the NCR_700_Host_Parameters pointer. However, hostdata is an array of unsigned longs, thus storing a pointer or unsigned long causes a buffer overflow on 64-bit platforms.

Applied to 7.5/scsi-staging, thanks!

Signature · 1 line
Martin K. Petersen