aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Chadd <adrian@FreeBSD.org>2012-11-02 05:22:32 +0000
committerAdrian Chadd <adrian@FreeBSD.org>2012-11-02 05:22:32 +0000
commit0fd5c7438168b6bd00ad68ed6492b5d89784195a (patch)
tree3da6e040d572b390e12b4de99a9a33d1c8552b70
parentffdbf9da3bb1f4b84bbf8f44778b7b91c3df1b92 (diff)
downloadsrc-0fd5c7438168b6bd00ad68ed6492b5d89784195a.tar.gz
src-0fd5c7438168b6bd00ad68ed6492b5d89784195a.zip
Free the dma map -after- it's checked, not before. Or you'll be
potentially referencing already-freed memory.
Notes
Notes: svn path=/head/; revision=242465
-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 62e5efda96d2..0251f3fe9377 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);
}