⬢ DragonFlyBSD Kernel Audit
DF-3484 / fix.diff
← back to finding ↓ download raw
--- a/sys/netgraph/netgraph/ng_base.c
+++ b/sys/netgraph/netgraph/ng_base.c
@@
-static struct ng_queue_entry   *ngqbase;	/* items to be unqueued */
+static struct spinlock		 ngq_spin = SPINLOCK_INITIALIZER(ngq_spin);
+static struct ng_queue_entry   *ngqbase;	/* items to be unqueued */
@@
-	crit_enter();
+	crit_enter();
+	spin_lock(&ngq_spin);
@@
-	crit_exit();
+	spin_unlock(&ngq_spin);
+	crit_exit();
 (applied to every mutation of ngqbase/ngqlast/ngqsize/ngqfree/ngqfreesize in
  ng_getqblk/RETURN_QBLK/ng_queue_data/ng_queue_msg and the consumer; crit_enter
  alone is per-CPU and does not exclude cross-CPU producers/consumers)