svn commit: r255990 - stable/9/sys/powerpc/powerpc
Nathan Whitehorn
nwhitehorn at FreeBSD.org
Wed Oct 2 15:00:05 UTC 2013
Author: nwhitehorn
Date: Wed Oct 2 15:00:04 2013
New Revision: 255990
URL: http://svnweb.freebsd.org/changeset/base/255990
Log:
MFC r255614,255639:
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.
Modified:
stable/9/sys/powerpc/powerpc/busdma_machdep.c
Directory Properties:
stable/9/sys/ (props changed)
Modified: stable/9/sys/powerpc/powerpc/busdma_machdep.c
==============================================================================
--- stable/9/sys/powerpc/powerpc/busdma_machdep.c Wed Oct 2 14:43:17 2013 (r255989)
+++ stable/9/sys/powerpc/powerpc/busdma_machdep.c Wed Oct 2 15:00:04 2013 (r255990)
@@ -843,16 +843,19 @@ _bus_dmamap_complete(bus_dma_tag_t dmat,
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,
dmat->boundary, dmat->iommu_cookie);
+ if (segs != NULL)
+ memcpy(segs, map->segments, map->nsegs*sizeof(segs[0]));
+ else
+ segs = map->segments;
+
return (segs);
}
More information about the svn-src-stable-9
mailing list