diff options
author | nwhitehorn <nwhitehorn@FreeBSD.org> | 2013-09-16 14:32:56 +0000 |
---|---|---|
committer | nwhitehorn <nwhitehorn@FreeBSD.org> | 2013-09-16 14:32:56 +0000 |
commit | 626eb2ccd8a3bbca408634071db12f83cd7ac0b2 (patch) | |
tree | ba2d9659b6d1642d4cea531d98bffd88cdf5edbd /sys/powerpc | |
parent | a86ee2711c61c9d7366dec8b321dcc9a0c1bd5ea (diff) | |
download | FreeBSD-src-626eb2ccd8a3bbca408634071db12f83cd7ac0b2.zip FreeBSD-src-626eb2ccd8a3bbca408634071db12f83cd7ac0b2.tar.gz |
Fix bug in busdma: if segs is a preexisting buffer, we memcpy it
into the DMA map. The length of the buffer had not yet been
initialized, however, so this would copy gibberish unless it
happened to be right by chance. This bug mostly only affected
systems with IOMMUs.
Approved by: re (gjb)
MFC after: 3 days
Diffstat (limited to 'sys/powerpc')
-rw-r--r-- | sys/powerpc/powerpc/busdma_machdep.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/powerpc/powerpc/busdma_machdep.c b/sys/powerpc/powerpc/busdma_machdep.c index 4608729..951a76a 100644 --- a/sys/powerpc/powerpc/busdma_machdep.c +++ b/sys/powerpc/powerpc/busdma_machdep.c @@ -844,11 +844,11 @@ _bus_dmamap_complete(bus_dma_tag_t dmat, bus_dmamap_t map, bus_dma_segment_t *segs, int nsegs, int error) { + map->nsegs = nsegs; if (segs != NULL) memcpy(map->segments, segs, map->nsegs*sizeof(segs[0])); else segs = map->segments; - map->nsegs = nsegs; if (dmat->iommu != NULL) IOMMU_MAP(dmat->iommu, map->segments, &map->nsegs, dmat->lowaddr, dmat->highaddr, dmat->alignment, |