mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-18 14:23:55 +00:00
Free the dma map -after- it's checked, not before. Or you'll be
potentially referencing already-freed memory.
This commit is contained in:
parent
ffdbf9da3b
commit
0fd5c74381
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=242465
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue