summaryrefslogtreecommitdiffstats
path: root/sys/netinet/if_ether.c
diff options
context:
space:
mode:
authorkrw <krw@openbsd.org>2008-05-11 03:50:23 +0000
committerkrw <krw@openbsd.org>2008-05-11 03:50:23 +0000
commite212aded5eb3473497a5b65bc7dc718508e71b31 (patch)
tree5f11084b540c468a0a13f9bead941c2120ce18eb /sys/netinet/if_ether.c
parentFix a typo with the media duplex flag being used for AUI connections (diff)
downloadwireguard-openbsd-e212aded5eb3473497a5b65bc7dc718508e71b31.tar.xz
wireguard-openbsd-e212aded5eb3473497a5b65bc7dc718508e71b31.zip
Try harder to avoid corrupting the mbuf pool. Stuff any mbuf chain in
ln_hold or la_hold into temporary storage and null ln_hold or la_hold before manually processing the mbuf chain. Discard the mbuf chain if it is put back in the hold area. ok claudio@ markus@
Diffstat (limited to 'sys/netinet/if_ether.c')
-rw-r--r--sys/netinet/if_ether.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/sys/netinet/if_ether.c b/sys/netinet/if_ether.c
index 77f4718a1b6..1f1adef8b8b 100644
--- a/sys/netinet/if_ether.c
+++ b/sys/netinet/if_ether.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ether.c,v 1.73 2008/05/09 15:48:59 claudio Exp $ */
+/* $OpenBSD: if_ether.c,v 1.74 2008/05/11 03:50:23 krw Exp $ */
/* $NetBSD: if_ether.c,v 1.31 1996/05/11 12:59:58 mycroft Exp $ */
/*
@@ -696,9 +696,14 @@ in_arpinput(m)
rt->rt_flags &= ~RTF_REJECT;
la->la_asked = 0;
if (la->la_hold) {
- (*ac->ac_if.if_output)(&ac->ac_if, la->la_hold,
- rt_key(rt), rt);
- la->la_hold = 0;
+ struct mbuf *n = la->la_hold;
+ la->la_hold = NULL;
+ (*ac->ac_if.if_output)(&ac->ac_if, n, rt_key(rt), rt);
+ if (la->la_hold == n) {
+ /* n is back in la_hold. Discard. */
+ m_freem(la->la_hold);
+ la->la_hold = NULL;
+ }
}
}
reply: