]> git.hungrycats.org Git - linux/commitdiff
[PATCH] atp870u oops fix
authorAndrew Morton <akpm@osdl.org>
Wed, 22 Oct 2003 01:19:41 +0000 (18:19 -0700)
committerLinus Torvalds <torvalds@home.osdl.org>
Wed, 22 Oct 2003 01:19:41 +0000 (18:19 -0700)
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.

drivers/scsi/atp870u.c

index 8a1d588d3b6d1cadad133f366220946724865c82..b8058fa52808f35dd34c1c5c8951b21c6b5425f0 100644 (file)
@@ -2335,11 +2335,8 @@ static int atp870u_detect(Scsi_Host_Template * tpnt)
                                break;
                }
        }
-       for (h = 0; h < MAX_ATP; h++) {
+       for (h = 0; h < card; h++) {
                struct atp_unit tmp, *dev;
-               if (pdev[h] == NULL) {
-                       return count;
-               }
 
                /* Found an atp870u/w. */
                base_io = pci_resource_start(pdev[h], 0);