diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2006-12-30 22:34:54 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2006-12-30 22:34:54 +0000 |
commit | 176ba5afb38ff8c1af0458556877f76175414932 (patch) | |
tree | 1436b6970cadbed4a72d5ec6ab477d3b72389c6a /sys/dev/usb | |
parent | 1d23cc5eb03d36d530f23925c0812d255d82e14e (diff) |
Don't use M_DUP_PKTHDR() on static mbufs. M_DUP_PKTHDR() copies the mtag
chain and so a later MFREE() is needed to free the chain again.
In this special case we get away by initializing a minimal mbuf header
instead of the M_DUP_PKTHDR() because bpf_mtap() does not access the pkthdr.
This fixes kettenis@ mtag memory leak on armish.
Tested by kettenis@ OK mglocker@ Sounds good jsg@
Diffstat (limited to 'sys/dev/usb')
-rw-r--r-- | sys/dev/usb/if_rum.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/dev/usb/if_rum.c b/sys/dev/usb/if_rum.c index 2fd243ac793..c25b9c24c4e 100644 --- a/sys/dev/usb/if_rum.c +++ b/sys/dev/usb/if_rum.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_rum.c,v 1.48 2006/12/07 17:32:19 damien Exp $ */ +/* $OpenBSD: if_rum.c,v 1.49 2006/12/30 22:34:53 claudio Exp $ */ /*- * Copyright (c) 2005, 2006 Damien Bergamini <damien.bergamini@free.fr> @@ -825,11 +825,12 @@ rum_rxeof(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status) tap->wr_antenna = sc->rx_ant; tap->wr_antsignal = desc->rssi; - M_DUP_PKTHDR(&mb, m); mb.m_data = (caddr_t)tap; mb.m_len = sc->sc_rxtap_len; mb.m_next = m; - mb.m_pkthdr.len += mb.m_len; + mb.m_nextpkt = NULL; + mb.m_type = 0; + mb.m_flags = 0; bpf_mtap(sc->sc_drvbpf, &mb, BPF_DIRECTION_IN); } #endif @@ -1170,11 +1171,12 @@ rum_tx_data(struct rum_softc *sc, struct mbuf *m0, struct ieee80211_node *ni) tap->wt_chan_flags = htole16(ic->ic_bss->ni_chan->ic_flags); tap->wt_antenna = sc->tx_ant; - M_DUP_PKTHDR(&mb, m0); mb.m_data = (caddr_t)tap; mb.m_len = sc->sc_txtap_len; mb.m_next = m0; - mb.m_pkthdr.len += mb.m_len; + mb.m_nextpkt = NULL; + mb.m_type = 0; + mb.m_flags = 0; bpf_mtap(sc->sc_drvbpf, &mb, BPF_DIRECTION_OUT); } #endif |