diff options
| author | rin <rin@NetBSD.org> | 2022-05-23 13:53:37 +0000 |
|---|---|---|
| committer | rin <rin@NetBSD.org> | 2022-05-23 13:53:37 +0000 |
| commit | ca21b0fc0278a90536e6f5e4151abb56c9632f85 (patch) | |
| tree | 8d7245e9e0fa622d4c672e46a6f468cb8b7c28ea /sys/dev | |
| parent | edf885ddb2f50e6ea7cee47c9e60f35833cb74e7 (diff) | |
Audit unload/unmap v.s. free against DMA buffer for sys/dev/pci;
make sure that bus_dmamap_unload(9) [or bus_dmamap_destroy(9)] or
bus_dmamem_unmap(9) are preceding to freeing DMA buffer, if it is
loaded or mapped, respectively.
This is mandatory for some archs. See, e.g.:
http://www.nerv.org/netbsd/?q=id:20210511T013030Z.013443cc790088147e4beed43f53dedabeaf9312
http://www.nerv.org/netbsd/?q=id:20220511T172220Z.561179f0b6fcc5b9cd73e274f69d74e2ce9e4c93
XXX XXX XXX
Compile test only (for amd64/ALL).
Thanks riastradh@ for double check.
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/pci/bktr/bktr_os.c | 5 | ||||
| -rw-r--r-- | sys/dev/pci/esm.c | 12 | ||||
| -rw-r--r-- | sys/dev/pci/if_bwfm_pci.c | 5 | ||||
| -rw-r--r-- | sys/dev/pci/if_ena.c | 10 | ||||
| -rw-r--r-- | sys/dev/pci/if_iwi.c | 29 | ||||
| -rw-r--r-- | sys/dev/pci/if_ixl.c | 11 | ||||
| -rw-r--r-- | sys/dev/pci/if_sk.c | 10 | ||||
| -rw-r--r-- | sys/dev/pci/if_ti.c | 41 | ||||
| -rw-r--r-- | sys/dev/pci/if_vge.c | 8 | ||||
| -rw-r--r-- | sys/dev/pci/ubsec.c | 10 |
10 files changed, 74 insertions, 67 deletions
diff --git a/sys/dev/pci/bktr/bktr_os.c b/sys/dev/pci/bktr/bktr_os.c index 8c8c08ae552..234f5cbbaba 100644 --- a/sys/dev/pci/bktr/bktr_os.c +++ b/sys/dev/pci/bktr/bktr_os.c @@ -1,6 +1,6 @@ /* $SourceForge: bktr_os.c,v 1.5 2003/03/11 23:11:25 thomasklausner Exp $ */ -/* $NetBSD: bktr_os.c,v 1.68 2018/12/09 11:22:35 jdolecek Exp $ */ +/* $NetBSD: bktr_os.c,v 1.69 2022/05/23 13:53:37 rin Exp $ */ /* $FreeBSD: src/sys/dev/bktr/bktr_os.c,v 1.20 2000/10/20 08:16:53 roger Exp$ */ /* @@ -51,7 +51,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: bktr_os.c,v 1.68 2018/12/09 11:22:35 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bktr_os.c,v 1.69 2022/05/23 13:53:37 rin Exp $"); #ifdef __FreeBSD__ #include "bktr.h" @@ -1624,6 +1624,7 @@ free_bktr_mem(bktr_ptr_t bktr, bus_dmamap_t dmap, vaddr_t kva) { bus_dma_tag_t dmat = bktr->dmat; + bus_dmamap_unload(dmat, dmap); #ifdef __NetBSD__ bus_dmamem_unmap(dmat, (void *)kva, dmap->dm_mapsize); #else diff --git a/sys/dev/pci/esm.c b/sys/dev/pci/esm.c index 6f10300e4e6..3eee1fe9e8f 100644 --- a/sys/dev/pci/esm.c +++ b/sys/dev/pci/esm.c @@ -1,4 +1,4 @@ -/* $NetBSD: esm.c,v 1.65 2020/04/19 08:18:19 isaki Exp $ */ +/* $NetBSD: esm.c,v 1.66 2022/05/23 13:53:37 rin Exp $ */ /*- * Copyright (c) 2002, 2003 Matt Fredette @@ -66,7 +66,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: esm.c,v 1.65 2020/04/19 08:18:19 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: esm.c,v 1.66 2022/05/23 13:53:37 rin Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -1418,13 +1418,13 @@ esm_freemem(struct esm_softc *sc, struct esm_dma *p) if (p->size == 0) return; - bus_dmamem_free(sc->dmat, p->segs, p->nsegs); - - bus_dmamem_unmap(sc->dmat, p->addr, p->size); + bus_dmamap_unload(sc->dmat, p->map); bus_dmamap_destroy(sc->dmat, p->map); - bus_dmamap_unload(sc->dmat, p->map); + bus_dmamem_unmap(sc->dmat, p->addr, p->size); + + bus_dmamem_free(sc->dmat, p->segs, p->nsegs); p->size = 0; } diff --git a/sys/dev/pci/if_bwfm_pci.c b/sys/dev/pci/if_bwfm_pci.c index d7568ca95ef..7919e7467eb 100644 --- a/sys/dev/pci/if_bwfm_pci.c +++ b/sys/dev/pci/if_bwfm_pci.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_bwfm_pci.c,v 1.12 2022/04/24 07:11:31 skrll Exp $ */ +/* $NetBSD: if_bwfm_pci.c,v 1.13 2022/05/23 13:53:37 rin Exp $ */ /* $OpenBSD: if_bwfm_pci.c,v 1.18 2018/02/08 05:00:38 patrick Exp $ */ /* * Copyright (c) 2010-2016 Broadcom Corporation @@ -18,7 +18,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_bwfm_pci.c,v 1.12 2022/04/24 07:11:31 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_bwfm_pci.c,v 1.13 2022/05/23 13:53:37 rin Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -911,6 +911,7 @@ bdmfree: void bwfm_pci_dmamem_free(struct bwfm_pci_softc *sc, struct bwfm_pci_dmamem *bdm) { + bus_dmamap_unload(sc->sc_dmat, bdm->bdm_map); bus_dmamem_unmap(sc->sc_dmat, bdm->bdm_kva, bdm->bdm_size); bus_dmamem_free(sc->sc_dmat, &bdm->bdm_seg, 1); bus_dmamap_destroy(sc->sc_dmat, bdm->bdm_map); diff --git a/sys/dev/pci/if_ena.c b/sys/dev/pci/if_ena.c index 570f986c8b1..cc59fd9d6b3 100644 --- a/sys/dev/pci/if_ena.c +++ b/sys/dev/pci/if_ena.c @@ -36,7 +36,7 @@ #if 0 __FBSDID("$FreeBSD: head/sys/dev/ena/ena.c 333456 2018-05-10 09:37:54Z mw $"); #endif -__KERNEL_RCSID(0, "$NetBSD: if_ena.c,v 1.32 2021/09/23 10:31:23 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ena.c,v 1.33 2022/05/23 13:53:37 rin Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -793,12 +793,12 @@ ena_free_tx_resources(struct ena_adapter *adapter, int qid) /* Free buffer DMA maps, */ for (int i = 0; i < tx_ring->ring_size; i++) { - m_freem(tx_ring->tx_buffer_info[i].mbuf); - tx_ring->tx_buffer_info[i].mbuf = NULL; bus_dmamap_unload(adapter->sc_dmat, tx_ring->tx_buffer_info[i].map); bus_dmamap_destroy(adapter->sc_dmat, tx_ring->tx_buffer_info[i].map); + m_freem(tx_ring->tx_buffer_info[i].mbuf); + tx_ring->tx_buffer_info[i].mbuf = NULL; } /* And free allocated memory. */ @@ -994,12 +994,12 @@ ena_free_rx_resources(struct ena_adapter *adapter, unsigned int qid) /* Free buffer DMA maps, */ for (int i = 0; i < rx_ring->ring_size; i++) { - m_freem(rx_ring->rx_buffer_info[i].mbuf); - rx_ring->rx_buffer_info[i].mbuf = NULL; bus_dmamap_unload(adapter->sc_dmat, rx_ring->rx_buffer_info[i].map); bus_dmamap_destroy(adapter->sc_dmat, rx_ring->rx_buffer_info[i].map); + m_freem(rx_ring->rx_buffer_info[i].mbuf); + rx_ring->rx_buffer_info[i].mbuf = NULL; } #ifdef LRO diff --git a/sys/dev/pci/if_iwi.c b/sys/dev/pci/if_iwi.c index 1caf4356036..1b6b006f48a 100644 --- a/sys/dev/pci/if_iwi.c +++ b/sys/dev/pci/if_iwi.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_iwi.c,v 1.117 2021/09/09 23:26:36 riastradh Exp $ */ +/* $NetBSD: if_iwi.c,v 1.118 2022/05/23 13:53:37 rin Exp $ */ /* $OpenBSD: if_iwi.c,v 1.111 2010/11/15 19:11:57 damien Exp $ */ /*- @@ -19,7 +19,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.117 2021/09/09 23:26:36 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.118 2022/05/23 13:53:37 rin Exp $"); /*- * Intel(R) PRO/Wireless 2200BG/2225BG/2915ABG driver @@ -661,11 +661,6 @@ iwi_reset_tx_ring(struct iwi_softc *sc, struct iwi_tx_ring *ring) for (i = 0; i < ring->count; i++) { data = &ring->data[i]; - - if (data->m != NULL) { - m_freem(data->m); - data->m = NULL; - } if (data->map != NULL) { bus_dmamap_sync(sc->sc_dmat, data->map, 0, @@ -673,6 +668,11 @@ iwi_reset_tx_ring(struct iwi_softc *sc, struct iwi_tx_ring *ring) bus_dmamap_unload(sc->sc_dmat, data->map); } + if (data->m != NULL) { + m_freem(data->m); + data->m = NULL; + } + if (data->ni != NULL) { ieee80211_free_node(data->ni); data->ni = NULL; @@ -702,14 +702,14 @@ iwi_free_tx_ring(struct iwi_softc *sc, struct iwi_tx_ring *ring) for (i = 0; i < ring->count; i++) { data = &ring->data[i]; - if (data->m != NULL) { - m_freem(data->m); - } - if (data->map != NULL) { bus_dmamap_unload(sc->sc_dmat, data->map); bus_dmamap_destroy(sc->sc_dmat, data->map); } + + if (data->m != NULL) { + m_freem(data->m); + } } } @@ -776,15 +776,14 @@ iwi_free_rx_ring(struct iwi_softc *sc, struct iwi_rx_ring *ring) for (i = 0; i < ring->count; i++) { data = &ring->data[i]; - if (data->m != NULL) { - m_freem(data->m); - } - if (data->map != NULL) { bus_dmamap_unload(sc->sc_dmat, data->map); bus_dmamap_destroy(sc->sc_dmat, data->map); } + if (data->m != NULL) { + m_freem(data->m); + } } } diff --git a/sys/dev/pci/if_ixl.c b/sys/dev/pci/if_ixl.c index dc8791b5591..00363472884 100644 --- a/sys/dev/pci/if_ixl.c +++ b/sys/dev/pci/if_ixl.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ixl.c,v 1.82 2022/03/31 06:23:18 yamaguchi Exp $ */ +/* $NetBSD: if_ixl.c,v 1.83 2022/05/23 13:53:37 rin Exp $ */ /* * Copyright (c) 2013-2015, Intel Corporation @@ -74,7 +74,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.82 2022/03/31 06:23:18 yamaguchi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ixl.c,v 1.83 2022/05/23 13:53:37 rin Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -2532,9 +2532,6 @@ ixl_txr_free(struct ixl_softc *sc, struct ixl_tx_ring *txr) unsigned int i; softint_disestablish(txr->txr_si); - while ((m = pcq_get(txr->txr_intrq)) != NULL) - m_freem(m); - pcq_destroy(txr->txr_intrq); maps = txr->txr_maps; for (i = 0; i < sc->sc_tx_ring_ndescs; i++) { @@ -2543,6 +2540,10 @@ ixl_txr_free(struct ixl_softc *sc, struct ixl_tx_ring *txr) bus_dmamap_destroy(sc->sc_dmat, txm->txm_map); } + while ((m = pcq_get(txr->txr_intrq)) != NULL) + m_freem(m); + pcq_destroy(txr->txr_intrq); + ixl_dmamem_free(sc, &txr->txr_mem); mutex_destroy(&txr->txr_lock); kmem_free(maps, sizeof(maps[0]) * sc->sc_tx_ring_ndescs); diff --git a/sys/dev/pci/if_sk.c b/sys/dev/pci/if_sk.c index 64a2fbfe7ed..2eb36c257c5 100644 --- a/sys/dev/pci/if_sk.c +++ b/sys/dev/pci/if_sk.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_sk.c,v 1.110 2022/05/03 20:52:32 andvar Exp $ */ +/* $NetBSD: if_sk.c,v 1.111 2022/05/23 13:53:37 rin Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -115,7 +115,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_sk.c,v 1.110 2022/05/03 20:52:32 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_sk.c,v 1.111 2022/05/23 13:53:37 rin Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -2152,9 +2152,6 @@ sk_txeof(struct sk_if_softc *sc_if) if (sc_if->sk_cdata.sk_tx_chain[idx].sk_mbuf != NULL) { entry = sc_if->sk_cdata.sk_tx_map[idx]; - m_freem(sc_if->sk_cdata.sk_tx_chain[idx].sk_mbuf); - sc_if->sk_cdata.sk_tx_chain[idx].sk_mbuf = NULL; - bus_dmamap_sync(sc->sc_dmatag, entry->dmamap, 0, entry->dmamap->dm_mapsize, BUS_DMASYNC_POSTWRITE); @@ -2162,6 +2159,9 @@ sk_txeof(struct sk_if_softc *sc_if) SIMPLEQ_INSERT_TAIL(&sc_if->sk_txmap_head, entry, link); sc_if->sk_cdata.sk_tx_map[idx] = NULL; + + m_freem(sc_if->sk_cdata.sk_tx_chain[idx].sk_mbuf); + sc_if->sk_cdata.sk_tx_chain[idx].sk_mbuf = NULL; } sc_if->sk_cdata.sk_tx_cnt--; SK_INC(idx, SK_TX_RING_CNT); diff --git a/sys/dev/pci/if_ti.c b/sys/dev/pci/if_ti.c index ee8bbdd0f38..85c13737bcf 100644 --- a/sys/dev/pci/if_ti.c +++ b/sys/dev/pci/if_ti.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ti.c,v 1.122 2021/11/10 16:17:34 msaitoh Exp $ */ +/* $NetBSD: if_ti.c,v 1.123 2022/05/23 13:53:37 rin Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -81,7 +81,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_ti.c,v 1.122 2021/11/10 16:17:34 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ti.c,v 1.123 2022/05/23 13:53:37 rin Exp $"); #include "opt_inet.h" @@ -913,12 +913,12 @@ ti_free_rx_ring_std(struct ti_softc *sc) for (i = 0; i < TI_STD_RX_RING_CNT; i++) { if (sc->ti_cdata.ti_rx_std_chain[i] != NULL) { - m_freem(sc->ti_cdata.ti_rx_std_chain[i]); - sc->ti_cdata.ti_rx_std_chain[i] = NULL; - /* if (sc->std_dmamap[i] == 0) panic() */ bus_dmamap_destroy(sc->sc_dmat, sc->std_dmamap[i]); sc->std_dmamap[i] = 0; + + m_freem(sc->ti_cdata.ti_rx_std_chain[i]); + sc->ti_cdata.ti_rx_std_chain[i] = NULL; } memset((char *)&sc->ti_rdata->ti_rx_std_ring[i], 0, sizeof(struct ti_rx_desc)); @@ -984,12 +984,12 @@ ti_free_rx_ring_mini(struct ti_softc *sc) for (i = 0; i < TI_MINI_RX_RING_CNT; i++) { if (sc->ti_cdata.ti_rx_mini_chain[i] != NULL) { - m_freem(sc->ti_cdata.ti_rx_mini_chain[i]); - sc->ti_cdata.ti_rx_mini_chain[i] = NULL; - /* if (sc->mini_dmamap[i] == 0) panic() */ bus_dmamap_destroy(sc->sc_dmat, sc->mini_dmamap[i]); sc->mini_dmamap[i] = 0; + + m_freem(sc->ti_cdata.ti_rx_mini_chain[i]); + sc->ti_cdata.ti_rx_mini_chain[i] = NULL; } memset((char *)&sc->ti_rdata->ti_rx_mini_ring[i], 0, sizeof(struct ti_rx_desc)); @@ -1006,13 +1006,18 @@ ti_free_tx_ring(struct ti_softc *sc) for (i = 0; i < TI_TX_RING_CNT; i++) { if (sc->ti_cdata.ti_tx_chain[i] != NULL) { - m_freem(sc->ti_cdata.ti_tx_chain[i]); - sc->ti_cdata.ti_tx_chain[i] = NULL; + dma = sc->txdma[i]; + KDASSERT(dma != NULL); + bus_dmamap_sync(sc->sc_dmat, dma->dmamap, 0, + dma->dmamap->dm_mapsize, BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(sc->sc_dmat, dma->dmamap); - /* if (sc->txdma[i] == 0) panic() */ SIMPLEQ_INSERT_HEAD(&sc->txdma_list, sc->txdma[i], link); - sc->txdma[i] = 0; + sc->txdma[i] = NULL; + + m_freem(sc->ti_cdata.ti_tx_chain[i]); + sc->ti_cdata.ti_tx_chain[i] = NULL; } memset((char *)&sc->ti_rdata->ti_tx_ring[i], 0, sizeof(struct ti_tx_desc)); @@ -2070,9 +2075,6 @@ ti_txeof_tigon1(struct ti_softc *sc) if (cur_tx->ti_flags & TI_BDFLAG_END) if_statinc(ifp, if_opackets); if (sc->ti_cdata.ti_tx_chain[idx] != NULL) { - m_freem(sc->ti_cdata.ti_tx_chain[idx]); - sc->ti_cdata.ti_tx_chain[idx] = NULL; - dma = sc->txdma[idx]; KDASSERT(dma != NULL); bus_dmamap_sync(sc->sc_dmat, dma->dmamap, 0, @@ -2081,6 +2083,9 @@ ti_txeof_tigon1(struct ti_softc *sc) SIMPLEQ_INSERT_HEAD(&sc->txdma_list, dma, link); sc->txdma[idx] = NULL; + + m_freem(sc->ti_cdata.ti_tx_chain[idx]); + sc->ti_cdata.ti_tx_chain[idx] = NULL; } sc->ti_txcnt--; TI_INC(sc->ti_tx_saved_considx, TI_TX_RING_CNT); @@ -2115,9 +2120,6 @@ ti_txeof_tigon2(struct ti_softc *sc) if (cur_tx->ti_flags & TI_BDFLAG_END) if_statinc(ifp, if_opackets); if (sc->ti_cdata.ti_tx_chain[idx] != NULL) { - m_freem(sc->ti_cdata.ti_tx_chain[idx]); - sc->ti_cdata.ti_tx_chain[idx] = NULL; - dma = sc->txdma[idx]; KDASSERT(dma != NULL); bus_dmamap_sync(sc->sc_dmat, dma->dmamap, 0, @@ -2126,6 +2128,9 @@ ti_txeof_tigon2(struct ti_softc *sc) SIMPLEQ_INSERT_HEAD(&sc->txdma_list, dma, link); sc->txdma[idx] = NULL; + + m_freem(sc->ti_cdata.ti_tx_chain[idx]); + sc->ti_cdata.ti_tx_chain[idx] = NULL; } cnt++; sc->ti_txcnt--; diff --git a/sys/dev/pci/if_vge.c b/sys/dev/pci/if_vge.c index 6e642e32f2b..320584eecb2 100644 --- a/sys/dev/pci/if_vge.c +++ b/sys/dev/pci/if_vge.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_vge.c,v 1.83 2022/01/22 19:09:21 martin Exp $ */ +/* $NetBSD: if_vge.c,v 1.84 2022/05/23 13:53:37 rin Exp $ */ /*- * Copyright (c) 2004 @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_vge.c,v 1.83 2022/01/22 19:09:21 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vge.c,v 1.84 2022/05/23 13:53:37 rin Exp $"); /* * VIA Networking Technologies VT612x PCI gigabit ethernet NIC driver. @@ -1382,11 +1382,11 @@ vge_txeof(struct vge_softc *sc) } txs = &sc->sc_txsoft[idx]; - m_freem(txs->txs_mbuf); - txs->txs_mbuf = NULL; bus_dmamap_sync(sc->sc_dmat, txs->txs_dmamap, 0, txs->txs_dmamap->dm_mapsize, BUS_DMASYNC_POSTWRITE); bus_dmamap_unload(sc->sc_dmat, txs->txs_dmamap); + m_freem(txs->txs_mbuf); + txs->txs_mbuf = NULL; net_stat_ref_t nsr = IF_STAT_GETREF(ifp); if (txstat & (VGE_TDSTS_EXCESSCOLL | VGE_TDSTS_COLL)) if_statinc_ref(nsr, if_collisions); diff --git a/sys/dev/pci/ubsec.c b/sys/dev/pci/ubsec.c index 7c0b3edbc00..15bded42a0e 100644 --- a/sys/dev/pci/ubsec.c +++ b/sys/dev/pci/ubsec.c @@ -1,4 +1,4 @@ -/* $NetBSD: ubsec.c,v 1.59 2022/05/22 11:39:27 riastradh Exp $ */ +/* $NetBSD: ubsec.c,v 1.60 2022/05/23 13:53:37 rin Exp $ */ /* $FreeBSD: src/sys/dev/ubsec/ubsec.c,v 1.6.2.6 2003/01/23 21:06:43 sam Exp $ */ /* $OpenBSD: ubsec.c,v 1.143 2009/03/27 13:31:30 reyk Exp$ */ @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.59 2022/05/22 11:39:27 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ubsec.c,v 1.60 2022/05/23 13:53:37 rin Exp $"); #undef UBSEC_DEBUG @@ -1753,9 +1753,6 @@ ubsec_process(void *arg, struct cryptop *crp, int hint) errout: if (q != NULL) { - if ((q->q_dst_m != NULL) && (q->q_src_m != q->q_dst_m)) - m_freem(q->q_dst_m); - if (q->q_dst_map != NULL && q->q_dst_map != q->q_src_map) { bus_dmamap_unload(sc->sc_dmat, q->q_dst_map); } @@ -1763,6 +1760,9 @@ errout: bus_dmamap_unload(sc->sc_dmat, q->q_src_map); } + if ((q->q_dst_m != NULL) && (q->q_src_m != q->q_dst_m)) + m_freem(q->q_dst_m); + mutex_spin_enter(&sc->sc_mtx); SIMPLEQ_INSERT_TAIL(&sc->sc_freequeue, q, q_next); mutex_spin_exit(&sc->sc_mtx); |
