Assert that ifiq_destroy() is not called with the NET_LOCK() held.
authormpi <mpi@openbsd.org>
Thu, 25 Jan 2018 14:04:36 +0000 (14:04 +0000)
committermpi <mpi@openbsd.org>
Thu, 25 Jan 2018 14:04:36 +0000 (14:04 +0000)
Calling taskq_barrier() on a softnet thread while holding the lock
is clearly a deadlock.

ok visa@, dlg@, bluhm@

sys/net/ifq.c

index 99b4704..d790f43 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: ifq.c,v 1.21 2018/01/04 11:02:57 tb Exp $ */
+/*     $OpenBSD: ifq.c,v 1.22 2018/01/25 14:04:36 mpi Exp $ */
 
 /*
  * Copyright (c) 2015 David Gwynne <dlg@openbsd.org>
@@ -446,15 +446,8 @@ void
 ifiq_destroy(struct ifiqueue *ifiq)
 {
        if (!task_del(ifiq->ifiq_softnet, &ifiq->ifiq_task)) {
-               int netlocked = (rw_status(&netlock) == RW_WRITE);
-
-               if (netlocked) /* XXXSMP breaks atomicity */
-                       NET_UNLOCK();
-
+               NET_ASSERT_UNLOCKED();
                taskq_barrier(ifiq->ifiq_softnet);
-
-               if (netlocked)
-                       NET_LOCK();
        }
 
        /* don't need to lock because this is the last use of the ifiq */