summaryrefslogtreecommitdiffstats
path: root/sys/mips/mips/busdma_machdep.c
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2012-11-02 05:22:32 +0000
committeradrian <adrian@FreeBSD.org>2012-11-02 05:22:32 +0000
commit8acc9b770568bd367e441975450af95356b23f7d (patch)
tree3da6e040d572b390e12b4de99a9a33d1c8552b70 /sys/mips/mips/busdma_machdep.c
parent4354018055d167b2dd190c0ed81b74972a32fe2c (diff)
downloadFreeBSD-src-8acc9b770568bd367e441975450af95356b23f7d.zip
FreeBSD-src-8acc9b770568bd367e441975450af95356b23f7d.tar.gz
Free the dma map -after- it's checked, not before. Or you'll be
potentially referencing already-freed memory.
Diffstat (limited to 'sys/mips/mips/busdma_machdep.c')
-rw-r--r--sys/mips/mips/busdma_machdep.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/mips/mips/busdma_machdep.c b/sys/mips/mips/busdma_machdep.c
index 62e5efd..0251f3f 100644
--- a/sys/mips/mips/busdma_machdep.c
+++ b/sys/mips/mips/busdma_machdep.c
@@ -549,7 +549,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);
@@ -558,6 +557,7 @@ bus_dmamap_destroy(bus_dma_tag_t dmat, bus_dmamap_t map)
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);
}
OpenPOWER on IntegriCloud