Author: yongari
Date: Tue Oct 12 19:31:25 2010
New Revision: 213747
URL: http://svn.freebsd.org/changeset/base/213747

Log:
  Protect bge(4) from accessing invalid NIC internal memory regions
  on BCM5906.
  
  Tested by:    Buganini < buganini <> gmail dot com >

Modified:
  head/sys/dev/bge/if_bge.c

Modified: head/sys/dev/bge/if_bge.c
==============================================================================
--- head/sys/dev/bge/if_bge.c   Tue Oct 12 19:28:33 2010        (r213746)
+++ head/sys/dev/bge/if_bge.c   Tue Oct 12 19:31:25 2010        (r213747)
@@ -550,6 +550,10 @@ bge_readmem_ind(struct bge_softc *sc, in
        device_t dev;
        uint32_t val;
 
+       if (sc->bge_asicrev == BGE_ASICREV_BCM5906 &&
+           off >= BGE_STATS_BLOCK && off < BGE_SEND_RING_1_TO_4)
+               return (0);
+
        dev = sc->bge_dev;
 
        pci_write_config(dev, BGE_PCI_MEMWIN_BASEADDR, off, 4);
@@ -563,6 +567,10 @@ bge_writemem_ind(struct bge_softc *sc, i
 {
        device_t dev;
 
+       if (sc->bge_asicrev == BGE_ASICREV_BCM5906 &&
+           off >= BGE_STATS_BLOCK && off < BGE_SEND_RING_1_TO_4)
+               return;
+
        dev = sc->bge_dev;
 
        pci_write_config(dev, BGE_PCI_MEMWIN_BASEADDR, off, 4);
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to