diff options
author | 2015-09-11 08:59:48 +0000 | |
---|---|---|
committer | 2015-09-11 08:59:48 +0000 | |
commit | 552c858c4648b4859104e22b417b1a24fd95acea (patch) | |
tree | dfeff690b7fc030b2ae49c0c7cb8a0935d114692 | |
parent | iterate over the new half of the if idx map rather than loop on the one (diff) | |
download | wireguard-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.c | 4 |
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; /* |