summaryrefslogtreecommitdiff
path: root/sys/net/if_pppoe.c
diff options
context:
space:
mode:
authorBrad Smith <brad@cvs.openbsd.org>2008-02-20 09:37:53 +0000
committerBrad Smith <brad@cvs.openbsd.org>2008-02-20 09:37:53 +0000
commit7444b3884b447e65f1338853abfda93b9dd4897d (patch)
tree6ac37e1ccab4f9ec10dff9b6969ee038c510474d /sys/net/if_pppoe.c
parent056a7a367bdf9aaa483176042fc1cd61c544b508 (diff)
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@
Diffstat (limited to 'sys/net/if_pppoe.c')
-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);