Module Name:    src
Committed By:   msaitoh
Date:           Tue May  7 15:23:32 UTC 2019

Modified Files:
        src/sys/dev/pci: if_txp.c

Log Message:
- Use bus_dmamem_unmap() correctly in txp_dma_free() to prevent panic.
  The code was wrong since rev. 1.1. This panic was found by adding KASSERT
  in uvm_map.c rev. 1.351. This bug may be related to PR kern/26204.
- Use aprint_normal() for non-error message.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/dev/pci/if_txp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/if_txp.c
diff -u src/sys/dev/pci/if_txp.c:1.53 src/sys/dev/pci/if_txp.c:1.54
--- src/sys/dev/pci/if_txp.c:1.53	Fri Apr 26 06:33:34 2019
+++ src/sys/dev/pci/if_txp.c	Tue May  7 15:23:32 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: if_txp.c,v 1.53 2019/04/26 06:33:34 msaitoh Exp $ */
+/* $NetBSD: if_txp.c,v 1.54 2019/05/07 15:23:32 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2001
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_txp.c,v 1.53 2019/04/26 06:33:34 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_txp.c,v 1.54 2019/05/07 15:23:32 msaitoh Exp $");
 
 #include "opt_inet.h"
 
@@ -257,7 +257,7 @@ txp_attach(device_t parent, device_t sel
 		aprint_normal("\n");
 		return;
 	}
-	aprint_error(": interrupting at %s\n", intrstr);
+	aprint_normal(": interrupting at %s\n", intrstr);
 
 	if (txp_chip_init(sc))
 		goto cleanupintr;
@@ -1237,8 +1237,10 @@ fail_0:
 void
 txp_dma_free(struct txp_softc *sc, struct txp_dma_alloc *dma)
 {
+	bus_size_t mapsize = dma->dma_map->dm_mapsize;
+
 	bus_dmamap_unload(sc->sc_dmat, dma->dma_map);
-	bus_dmamem_unmap(sc->sc_dmat, dma->dma_vaddr, dma->dma_map->dm_mapsize);
+	bus_dmamem_unmap(sc->sc_dmat, dma->dma_vaddr, mapsize);
 	bus_dmamem_free(sc->sc_dmat, &dma->dma_seg, dma->dma_nseg);
 	bus_dmamap_destroy(sc->sc_dmat, dma->dma_map);
 }

Reply via email to