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

on BCM5906.

Tested by:	Buganini < buganini <> gmail dot com >
This commit is contained in:
Pyun YongHyeon 2010-10-12 19:31:25 +00:00
parent 9d22cd9be8
commit a4431eba57

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