Author: scottl Date: Mon Jun 17 19:45:27 2013 New Revision: 251860 URL: http://svnweb.freebsd.org/changeset/base/251860
Log: MFC r242465: Free the dma map -after- it's checked, not before. Or you'll be potentially referencing already-freed memory. MFC r242466: Drop this from 500 to 128, to save a little space on memory constrained platforms. Submitted by: adrian Obtained from: Netflix Modified: stable/9/sys/mips/mips/busdma_machdep.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/mips/mips/busdma_machdep.c ============================================================================== --- stable/9/sys/mips/mips/busdma_machdep.c Mon Jun 17 19:31:03 2013 (r251859) +++ stable/9/sys/mips/mips/busdma_machdep.c Mon Jun 17 19:45:27 2013 (r251860) @@ -152,7 +152,7 @@ static STAILQ_HEAD(, bus_dmamap) bounce_ static TAILQ_HEAD(,bus_dmamap) dmamap_freelist = TAILQ_HEAD_INITIALIZER(dmamap_freelist); -#define BUSDMA_STATIC_MAPS 500 +#define BUSDMA_STATIC_MAPS 128 static struct bus_dmamap map_pool[BUSDMA_STATIC_MAPS]; static struct mtx busdma_mtx; @@ -533,7 +533,6 @@ int bus_dmamap_destroy(bus_dma_tag_t dmat, bus_dmamap_t map) { - _busdma_free_dmamap(map); if (STAILQ_FIRST(&map->bpages) != NULL) { CTR3(KTR_BUSDMA, "%s: tag %p error %d", __func__, dmat, EBUSY); @@ -542,6 +541,7 @@ bus_dmamap_destroy(bus_dma_tag_t dmat, b if (dmat->bounce_zone) dmat->bounce_zone->map_count--; dmat->map_count--; + _busdma_free_dmamap(map); CTR2(KTR_BUSDMA, "%s: tag %p error 0", __func__, dmat); return (0); } _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"