summaryrefslogtreecommitdiff
path: root/sys/net/if.c
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2018-03-20 08:58:20 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2018-03-20 08:58:20 +0000
commit1f9be315e726a23aa52c9fb5cbd2180e10f8eded (patch)
tree05d9ce127f94101db56cda7f28e6506d110abd5a /sys/net/if.c
parent698dd736fb2ab693410738a4dad76448a88bbc28 (diff)
Call bpfdetach() without holding the NET_LOCK().
Prevents a rwlock recursion found by stsp@. ok stsp@, deraadt@, visa@
Diffstat (limited to 'sys/net/if.c')
-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)