From a4431eba574ae5bae8a0bff6541080d9d7018b86 Mon Sep 17 00:00:00 2001 From: Pyun YongHyeon Date: Tue, 12 Oct 2010 19:31:25 +0000 Subject: [PATCH] Protect bge(4) from accessing invalid NIC internal memory regions on BCM5906. Tested by: Buganini < buganini <> gmail dot com > --- sys/dev/bge/if_bge.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sys/dev/bge/if_bge.c b/sys/dev/bge/if_bge.c index 5ced81fb1edc..1b29f4cac424 100644 --- a/sys/dev/bge/if_bge.c +++ b/sys/dev/bge/if_bge.c @@ -550,6 +550,10 @@ bge_readmem_ind(struct bge_softc *sc, int off) 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, int off, int val) { 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);