Protect bge(4) from accessing invalid NIC internal memory regions

on BCM5906.

Tested by:	Buganini < buganini <> gmail dot com >
This commit is contained in:
yongari 2010-10-12 19:31:25 +00:00
parent 93c40b656a
commit 8bd9ea7447

View File

@ -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);