Module Name:    src
Committed By:   riastradh
Date:           Tue May 17 10:28:08 UTC 2022

Modified Files:
        src/sys/net: pfil.c

Log Message:
pfil(9): Assert pfil lists are not run in interrupt context.

All the paths leading to this should have been dispensed with by now.
The network stack runs in thread or softint context these days; hard
interrupt context is used only to put packets on queues deferred to
softint.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/net/pfil.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/pfil.c
diff -u src/sys/net/pfil.c:1.40 src/sys/net/pfil.c:1.41
--- src/sys/net/pfil.c:1.40	Tue May 17 10:27:37 2022
+++ src/sys/net/pfil.c	Tue May 17 10:28:08 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pfil.c,v 1.40 2022/05/17 10:27:37 riastradh Exp $	*/
+/*	$NetBSD: pfil.c,v 1.41 2022/05/17 10:28:08 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2013 Mindaugas Rasiukevicius <rmind at NetBSD org>
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pfil.c,v 1.40 2022/05/17 10:27:37 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pfil.c,v 1.41 2022/05/17 10:28:08 riastradh Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_net_mpsafe.h"
@@ -39,6 +39,7 @@ __KERNEL_RCSID(0, "$NetBSD: pfil.c,v 1.4
 #include <sys/queue.h>
 #include <sys/kmem.h>
 #include <sys/psref.h>
+#include <sys/cpu.h>
 
 #include <net/if.h>
 #include <net/pfil.h>
@@ -411,6 +412,7 @@ pfil_run_hooks(pfil_head_t *ph, struct m
 	int ret = 0;
 
 	KASSERT(dir == PFIL_IN || dir == PFIL_OUT);
+	KASSERT(!cpu_intr_p());
 
 	if (ph == NULL) {
 		return ret;
@@ -449,6 +451,8 @@ pfil_run_arg(pfil_listset_t *phlistset, 
 	struct psref psref;
 	int s, bound;
 
+	KASSERT(!cpu_intr_p());
+
 	bound = curlwp_bind();
 	s = pserialize_read_enter();
 	phlist = atomic_load_consume(&phlistset->active);

Reply via email to