Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Oct 2010 19:31:25 +0000 (UTC)
From:      Pyun YongHyeon <yongari@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r213747 - head/sys/dev/bge
Message-ID:  <201010121931.o9CJVPnK059788@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010121931.o9CJVPnK059788>