Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Sep 2013 14:32:56 +0000 (UTC)
From:      Nathan Whitehorn <nwhitehorn@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r255614 - head/sys/powerpc/powerpc
Message-ID:  <201309161432.r8GEWuBx006275@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: nwhitehorn
Date: Mon Sep 16 14:32:56 2013
New Revision: 255614
URL: http://svnweb.freebsd.org/changeset/base/255614

Log:
  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

Modified:
  head/sys/powerpc/powerpc/busdma_machdep.c

Modified: head/sys/powerpc/powerpc/busdma_machdep.c
==============================================================================
--- head/sys/powerpc/powerpc/busdma_machdep.c	Mon Sep 16 10:46:58 2013	(r255613)
+++ head/sys/powerpc/powerpc/busdma_machdep.c	Mon Sep 16 14:32:56 2013	(r255614)
@@ -844,11 +844,11 @@ _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,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201309161432.r8GEWuBx006275>