summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2015-09-11 08:59:48 +0000
committermpi <mpi@openbsd.org>2015-09-11 08:59:48 +0000
commit552c858c4648b4859104e22b417b1a24fd95acea (patch)
treedfeff690b7fc030b2ae49c0c7cb8a0935d114692
parentiterate over the new half of the if idx map rather than loop on the one (diff)
downloadwireguard-openbsd-552c858c4648b4859104e22b417b1a24fd95acea.tar.xz
wireguard-openbsd-552c858c4648b4859104e22b417b1a24fd95acea.zip
FOREACH macro is not safe to use when removing elements on a list.
Should fix a NULL dereference reported by guenther@. ok dlg@
-rw-r--r--sys/net/bpf.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index 1f493d906c5..0af1d15b9e3 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bpf.c,v 1.124 2015/09/09 11:55:37 dlg Exp $ */
+/* $OpenBSD: bpf.c,v 1.125 2015/09/11 08:59:48 mpi Exp $ */
/* $NetBSD: bpf.c,v 1.33 1997/02/21 23:59:35 thorpej Exp $ */
/*
@@ -1498,7 +1498,7 @@ bpfdetach(struct ifnet *ifp)
if (cdevsw[maj].d_open == bpfopen)
break;
- SRPL_FOREACH_LOCKED(bd, &bp->bif_dlist, bd_next) {
+ while ((bd = SRPL_FIRST_LOCKED(&bp->bif_dlist))) {
struct bpf_d *d;
/*