diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2019-05-10 12:41:31 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2019-05-10 12:41:31 +0000 |
commit | 5487c94db89e6cee4d59ac1586573dc7551ca714 (patch) | |
tree | d83ee1e9603dfa0b8c0a4a618a15a5c75f3742d3 /sys/net/if_bridge.c | |
parent | 717c86556913cde4e17f40a12dd5a1cf3fe2834b (diff) |
Move bridge_filterrule() before doing the mbuf copy. Fixes a memory leak
when multiple interfaces do MAC filtering.
Memory leak reported by Daniel Levai
With and OK mpi@
Diffstat (limited to 'sys/net/if_bridge.c')
-rw-r--r-- | sys/net/if_bridge.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/net/if_bridge.c b/sys/net/if_bridge.c index 67f0e6ab754..24515e1ae32 100644 --- a/sys/net/if_bridge.c +++ b/sys/net/if_bridge.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_bridge.c,v 1.329 2019/05/03 16:53:07 bluhm Exp $ */ +/* $OpenBSD: if_bridge.c,v 1.330 2019/05/10 12:41:30 claudio Exp $ */ /* * Copyright (c) 1999, 2000 Jason L. Wright (jason@thought.net) @@ -808,6 +808,10 @@ bridge_enqueue(struct ifnet *ifp, struct mbuf *m) (m->m_flags & (M_BCAST | M_MCAST)) == 0) continue; + if (bridge_filterrule(&bif->bif_brlout, eh, m) == + BRL_ACTION_BLOCK) + continue; + if (SLIST_NEXT(bif, bif_next) == NULL) { used = 1; mc = m; @@ -819,10 +823,6 @@ bridge_enqueue(struct ifnet *ifp, struct mbuf *m) } } - if (bridge_filterrule(&bif->bif_brlout, eh, mc) == - BRL_ACTION_BLOCK) - continue; - error = bridge_ifenqueue(brifp, dst_if, mc); if (error) continue; @@ -1249,7 +1249,8 @@ bridge_broadcast(struct bridge_softc *sc, struct ifnet *ifp, if (protected != 0 && (protected & bif->bif_protected)) continue; - if (bridge_filterrule(&bif->bif_brlout, eh, m) == BRL_ACTION_BLOCK) + if (bridge_filterrule(&bif->bif_brlout, eh, m) == + BRL_ACTION_BLOCK) continue; /* |