summaryrefslogtreecommitdiff
path: root/sys/dev/pci/if_ix.c
diff options
context:
space:
mode:
authorMike Belopuhov <mikeb@cvs.openbsd.org>2011-12-12 20:45:31 +0000
committerMike Belopuhov <mikeb@cvs.openbsd.org>2011-12-12 20:45:31 +0000
commitc87647cb851030fe1b4adad4f6aa27d9a247b8f3 (patch)
treee5ffa5a6a4893092b004337161debe6b3b3d5d15 /sys/dev/pci/if_ix.c
parent125c3ff4093fd2ee1abaab72dcb5e0e00efde1c8 (diff)
add missing m_freem's into the error code paths. there's no change
in behavior since we don't do split headers; ok dlg, kettenis
Diffstat (limited to 'sys/dev/pci/if_ix.c')
-rw-r--r--sys/dev/pci/if_ix.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/sys/dev/pci/if_ix.c b/sys/dev/pci/if_ix.c
index a445e636135..e09e66870ce 100644
--- a/sys/dev/pci/if_ix.c
+++ b/sys/dev/pci/if_ix.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ix.c,v 1.57 2011/12/09 11:43:41 mikeb Exp $ */
+/* $OpenBSD: if_ix.c,v 1.58 2011/12/12 20:45:30 mikeb Exp $ */
/******************************************************************************
@@ -2549,7 +2549,7 @@ ixgbe_get_buf(struct rx_ring *rxr, int i)
{
struct ix_softc *sc = rxr->sc;
struct ixgbe_rx_buf *rxbuf;
- struct mbuf *mh, *mp;
+ struct mbuf *mp, *mh = NULL;
int error;
union ixgbe_adv_rx_desc *rxdesc;
size_t dsize = sizeof(union ixgbe_adv_rx_desc);
@@ -2573,8 +2573,10 @@ ixgbe_get_buf(struct rx_ring *rxr, int i)
goto no_split;
mh = m_gethdr(M_DONTWAIT, MT_DATA);
- if (mh == NULL)
+ if (mh == NULL) {
+ m_freem(mp);
return (ENOBUFS);
+ }
mh->m_pkthdr.len = mh->m_len = MHLEN;
mh->m_len = MHLEN;
@@ -2584,6 +2586,7 @@ ixgbe_get_buf(struct rx_ring *rxr, int i)
error = bus_dmamap_load_mbuf(rxr->rxdma.dma_tag, rxbuf->hmap,
mh, BUS_DMA_NOWAIT);
if (error) {
+ m_freem(mp);
m_freem(mh);
return (error);
}
@@ -2603,6 +2606,11 @@ no_split:
error = bus_dmamap_load_mbuf(rxr->rxdma.dma_tag, rxbuf->pmap,
mp, BUS_DMA_NOWAIT);
if (error) {
+ if (mh) {
+ bus_dmamap_unload(rxr->rxdma.dma_tag, rxbuf->hmap);
+ rxbuf->m_head = NULL;
+ m_freem(mh);
+ }
m_freem(mp);
return (error);
}