summaryrefslogtreecommitdiffstats
path: root/sys/dev/bge
diff options
context:
space:
mode:
authoryongari <yongari@FreeBSD.org>2010-10-12 19:31:25 +0000
committeryongari <yongari@FreeBSD.org>2010-10-12 19:31:25 +0000
commit8bd9ea7447f4ba61d88ff51f365ca8796ee2b38c (patch)
treeeff5a4ac001796689e52296a327a6c1874aa4fd4 /sys/dev/bge
parent93c40b656a3514a4a5fb40da5e5aad34a069af86 (diff)
downloadFreeBSD-src-8bd9ea7447f4ba61d88ff51f365ca8796ee2b38c.zip
FreeBSD-src-8bd9ea7447f4ba61d88ff51f365ca8796ee2b38c.tar.gz
Protect bge(4) from accessing invalid NIC internal memory regions
on BCM5906. Tested by: Buganini < buganini <> gmail dot com >
Diffstat (limited to 'sys/dev/bge')
-rw-r--r--sys/dev/bge/if_bge.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/dev/bge/if_bge.c b/sys/dev/bge/if_bge.c
index 5ced81f..1b29f4c 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);
OpenPOWER on IntegriCloud