Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci - Use bus_dmamem_unmap() correctly in txp_dma_fr...



details:   https://anonhg.NetBSD.org/src/rev/a5017c1e0922
branches:  trunk
changeset: 451130:a5017c1e0922
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Tue May 07 15:23:32 2019 +0000

description:
- 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.

diffstat:

 sys/dev/pci/if_txp.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (39 lines):

diff -r d24d597fddb3 -r a5017c1e0922 sys/dev/pci/if_txp.c
--- a/sys/dev/pci/if_txp.c      Tue May 07 10:22:54 2019 +0000
+++ b/sys/dev/pci/if_txp.c      Tue May 07 15:23:32 2019 +0000
@@ -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 @@
                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 @@
 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);
 }



Home | Main Index | Thread Index | Old Index