]> git.lizzy.rs Git - plan9front.git/commitdiff
zynq: fix out of bounds access in etherprobe()
authorcinap_lenrek <cinap_lenrek@felloff.net>
Wed, 25 Mar 2015 02:03:24 +0000 (03:03 +0100)
committercinap_lenrek <cinap_lenrek@felloff.net>
Wed, 25 Mar 2015 02:03:24 +0000 (03:03 +0100)
calling etherprobe() with -1 cardno will rereference
and call cards[-1].reset() which is wrong. don't do that!

sys/src/9/zynq/devether.c
sys/src/9/zynq/etherif.h

index c6ed2eac37304338cb87efebd5b89bfdab37536f..90777e6f5241b7d1dfe8b81ecd01cd035cda2e3d 100644 (file)
@@ -435,12 +435,6 @@ etherreset(void)
        Ether *ether;
        int cardno, ctlrno;
 
-       for(ctlrno = 0; ctlrno < MaxEther; ctlrno++){
-               if((ether = etherprobe(-1, ctlrno)) == nil)
-                       continue;
-               etherxx[ctlrno] = ether;
-       }
-
        cardno = ctlrno = 0;
        while(cards[cardno].type != nil && ctlrno < MaxEther){
                if(etherxx[ctlrno] != nil){
index d7ea87523285c505b0ff7fb3d73da8c86e2f138f..80a39aa8b2658315986c80e213b19ceccde3cf9c 100644 (file)
@@ -1,5 +1,5 @@
 enum {
-       MaxEther        = 64,
+       MaxEther        = 1,
        Ntypes          = 8,
 };