Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Nov 2015 02:23:36 +0000 (UTC)
From:      Marius Strobl <marius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r291088 - in head/sys: arm64/arm64 x86/x86
Message-ID:  <201511200223.tAK2Nasl087974@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marius
Date: Fri Nov 20 02:23:35 2015
New Revision: 291088
URL: https://svnweb.freebsd.org/changeset/base/291088

Log:
  Avoid a NULL pointer dereference in bounce_bus_dmamap_sync() when the
  map has been created via bounce_bus_dmamem_alloc(). Even for coherent
  DMA - which bus_dmamem_alloc(9) typically is used for -, calling of
  bus_dmamap_sync(9) isn't optional.
  
  PR:		188899 (non-original problem)
  MFC after:	3 days

Modified:
  head/sys/arm64/arm64/busdma_bounce.c
  head/sys/x86/x86/busdma_bounce.c

Modified: head/sys/arm64/arm64/busdma_bounce.c
==============================================================================
--- head/sys/arm64/arm64/busdma_bounce.c	Fri Nov 20 00:22:55 2015	(r291087)
+++ head/sys/arm64/arm64/busdma_bounce.c	Fri Nov 20 02:23:35 2015	(r291088)
@@ -767,7 +767,7 @@ bounce_bus_dmamap_sync(bus_dma_tag_t dma
 	struct bounce_page *bpage;
 	vm_offset_t datavaddr, tempvaddr;
 
-	if ((bpage = STAILQ_FIRST(&map->bpages)) == NULL)
+	if (map == NULL || (bpage = STAILQ_FIRST(&map->bpages)) == NULL)
 		return;
 
 	/*

Modified: head/sys/x86/x86/busdma_bounce.c
==============================================================================
--- head/sys/x86/x86/busdma_bounce.c	Fri Nov 20 00:22:55 2015	(r291087)
+++ head/sys/x86/x86/busdma_bounce.c	Fri Nov 20 02:23:35 2015	(r291088)
@@ -892,7 +892,7 @@ bounce_bus_dmamap_sync(bus_dma_tag_t dma
 	vm_offset_t datavaddr, tempvaddr;
 	bus_size_t datacount1, datacount2;
 
-	if ((bpage = STAILQ_FIRST(&map->bpages)) == NULL)
+	if (map == NULL || (bpage = STAILQ_FIRST(&map->bpages)) == NULL)
 		return;
 
 	/*



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