summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrad <brad@openbsd.org>2008-02-20 09:37:52 +0000
committerbrad <brad@openbsd.org>2008-02-20 09:37:52 +0000
commit3b60820404a3c4473b1481a314fd383839543e7a (patch)
treed4419716b9cb99d278e01018c75f8938d39feb36
parentmake sure we use the default branch (if available) (diff)
downloadwireguard-openbsd-3b60820404a3c4473b1481a314fd383839543e7a.tar.xz
wireguard-openbsd-3b60820404a3c4473b1481a314fd383839543e7a.zip
Fix a mbuf leak which can be triggered on a system
receiving PPPoE packets but without any PPPoE interfaces setup. From mickey@ via PR 5713. ok canacar@ claudio@ dlg@
-rw-r--r--sys/net/if_pppoe.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/sys/net/if_pppoe.c b/sys/net/if_pppoe.c
index 4686e8dd6bf..8d18f98e8bb 100644
--- a/sys/net/if_pppoe.c
+++ b/sys/net/if_pppoe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_pppoe.c,v 1.13 2007/09/15 16:43:51 henning Exp $ */
+/* $OpenBSD: if_pppoe.c,v 1.14 2008/02/20 09:37:52 brad Exp $ */
/* $NetBSD: if_pppoe.c,v 1.51 2003/11/28 08:56:48 keihan Exp $ */
/*
@@ -366,25 +366,22 @@ pppoe_find_softc_by_hunique(u_int8_t *token, size_t len, struct ifnet *rcvif)
void
pppoeintr(void)
{
- struct pppoe_softc *sc;
struct mbuf *m;
splassert(IPL_SOFTNET);
- LIST_FOREACH(sc, &pppoe_softc_list, sc_list) {
- while (ppoediscinq.ifq_head) {
- MBUFLOCK(IF_DEQUEUE(&ppoediscinq, m););
- if (m == NULL)
- break;
- pppoe_disc_input(m);
- }
+ while (ppoediscinq.ifq_head) {
+ MBUFLOCK(IF_DEQUEUE(&ppoediscinq, m););
+ if (m == NULL)
+ break;
+ pppoe_disc_input(m);
+ }
- while (ppoeinq.ifq_head) {
- MBUFLOCK(IF_DEQUEUE(&ppoeinq, m););
- if (m == NULL)
- break;
- pppoe_data_input(m);
- }
+ while (ppoeinq.ifq_head) {
+ MBUFLOCK(IF_DEQUEUE(&ppoeinq, m););
+ if (m == NULL)
+ break;
+ pppoe_data_input(m);
}
}
@@ -733,6 +730,8 @@ pppoe_data_input(struct mbuf *m)
#ifdef PPPOE_TERM_UNKNOWN_SESSIONS
u_int8_t shost[ETHER_ADDR_LEN];
#endif
+ if (LIST_EMPTY(&pppoe_softc_list))
+ goto drop;
KASSERT(m->m_flags & M_PKTHDR);