From 7444b3884b447e65f1338853abfda93b9dd4897d Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Wed, 20 Feb 2008 09:37:53 +0000 Subject: 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@ --- sys/net/if_pppoe.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'sys') 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); -- cgit v1.2.3