diff options
author | Joerg Goltermann <gollo@cvs.openbsd.org> | 2008-09-17 22:18:01 +0000 |
---|---|---|
committer | Joerg Goltermann <gollo@cvs.openbsd.org> | 2008-09-17 22:18:01 +0000 |
commit | 856abc40f5e309364d84e9e75693686f63551c07 (patch) | |
tree | 57bc803b408e490915eb9a9ef0c9f5fb5d85edbd /sys | |
parent | 4b116ec45fc9df55574b2a03bc2c723454d1b9f8 (diff) |
Solve m_free problem with a not correctly configured pflow interface
leading to a kernel crash reported in PR5930
OK claudio@ henning@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/net/if_pflow.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/sys/net/if_pflow.c b/sys/net/if_pflow.c index 91439b9e18b..418f5e47de8 100644 --- a/sys/net/if_pflow.c +++ b/sys/net/if_pflow.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pflow.c,v 1.4 2008/09/17 20:25:41 gollo Exp $ */ +/* $OpenBSD: if_pflow.c,v 1.5 2008/09/17 22:18:00 gollo Exp $ */ /* * Copyright (c) 2008 Henning Brauer <henning@openbsd.org> @@ -517,7 +517,7 @@ pflow_timeout(void *v) int pflow_sendout(struct pflow_softc *sc) { - struct mbuf *m; + struct mbuf *m = sc->sc_mbuf; struct pflow_header *h; #if NBPFILTER > 0 struct ifnet *ifp = &sc->sc_if; @@ -525,19 +525,17 @@ pflow_sendout(struct pflow_softc *sc) timeout_del(&sc->sc_tmo); - if (sc->sc_mbuf == NULL) + if (m == NULL) return (0); - pflowstats.pflow_packets++; - + sc->sc_mbuf = NULL; + sc->sc_flowp.s = NULL; if (!(ifp->if_flags & IFF_RUNNING)) { m_freem(m); return (0); } - m = sc->sc_mbuf; - sc->sc_mbuf = NULL; - sc->sc_flowp.s = NULL; + pflowstats.pflow_packets++; h = mtod(m, struct pflow_header *); h->count = htons(sc->sc_count); |