Commit 16715550 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] atp870u oops fix

This driver is taking uinitialised stack gunk from the pdev[] array and
feeding it into pci_read_config_byte() and crashing when modprobed with no
hardware present.

Fix it to not index past the initialised members of pdev[].

We don't know if this driver works.
parent 6edc4f5f
...@@ -2335,11 +2335,8 @@ static int atp870u_detect(Scsi_Host_Template * tpnt) ...@@ -2335,11 +2335,8 @@ static int atp870u_detect(Scsi_Host_Template * tpnt)
break; break;
} }
} }
for (h = 0; h < MAX_ATP; h++) { for (h = 0; h < card; h++) {
struct atp_unit tmp, *dev; struct atp_unit tmp, *dev;
if (pdev[h] == NULL) {
return count;
}
/* Found an atp870u/w. */ /* Found an atp870u/w. */
base_io = pci_resource_start(pdev[h], 0); base_io = pci_resource_start(pdev[h], 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment