summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2018-03-20 08:58:19 +0000
committermpi <mpi@openbsd.org>2018-03-20 08:58:19 +0000
commitdc68a81168b405cc69a629b7ce751e35f592d4b0 (patch)
treeabbf27daa243a816a984415bff5c0e6cc9a3a464 /sys
parentsync (diff)
downloadwireguard-openbsd-dc68a81168b405cc69a629b7ce751e35f592d4b0.tar.xz
wireguard-openbsd-dc68a81168b405cc69a629b7ce751e35f592d4b0.zip
Call bpfdetach() without holding the NET_LOCK().
Prevents a rwlock recursion found by stsp@. ok stsp@, deraadt@, visa@
Diffstat (limited to 'sys')
-rw-r--r--sys/net/if.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/net/if.c b/sys/net/if.c
index 7243b7be4d9..4905b757210 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.548 2018/03/02 15:52:11 claudio Exp $ */
+/* $OpenBSD: if.c,v 1.549 2018/03/20 08:58:19 mpi Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -1028,6 +1028,10 @@ if_detach(struct ifnet *ifp)
/* Other CPUs must not have a reference before we start destroying. */
if_idxmap_remove(ifp);
+#if NBPFILTER > 0
+ bpfdetach(ifp);
+#endif
+
NET_LOCK();
s = splnet();
ifp->if_qstart = if_detached_qstart;
@@ -1041,9 +1045,6 @@ if_detach(struct ifnet *ifp)
/* Remove the link state task */
task_del(net_tq(ifp->if_index), &ifp->if_linkstatetask);
-#if NBPFILTER > 0
- bpfdetach(ifp);
-#endif
rti_delete(ifp);
#if NETHER > 0 && defined(NFSCLIENT)
if (ifp->if_index == revarp_ifidx)