Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net pfil(9): Assert sleepable when editing pfil lists.



details:   https://anonhg.NetBSD.org/src/rev/db61284f795b
branches:  trunk
changeset: 366178:db61284f795b
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Tue May 17 10:27:37 2022 +0000

description:
pfil(9): Assert sleepable when editing pfil lists.

These might sleep to wait for users to drain.

diffstat:

 sys/net/pfil.c |  13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diffs (55 lines):

diff -r f9eec78f8785 -r db61284f795b sys/net/pfil.c
--- a/sys/net/pfil.c    Tue May 17 09:53:09 2022 +0000
+++ b/sys/net/pfil.c    Tue May 17 10:27:37 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pfil.c,v 1.39 2020/06/22 16:39:56 maxv Exp $   */
+/*     $NetBSD: pfil.c,v 1.40 2022/05/17 10:27:37 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.39 2020/06/22 16:39:56 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pfil.c,v 1.40 2022/05/17 10:27:37 riastradh Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_net_mpsafe.h"
@@ -266,6 +266,8 @@
        KASSERT(func != NULL);
        KASSERT((flags & ~PFIL_ALL) == 0);
 
+       ASSERT_SLEEPABLE();
+
        for (u_int i = 0; i < __arraycount(pfil_flag_cases); i++) {
                const int fcase = pfil_flag_cases[i];
                pfil_listset_t *phlistset;
@@ -300,6 +302,8 @@
        KASSERT(func != NULL);
        KASSERT(flags == PFIL_IFADDR || flags == PFIL_IFNET);
 
+       ASSERT_SLEEPABLE();
+
        phlistset = pfil_hook_get(flags, ph);
        return pfil_list_add(phlistset, (pfil_polyfunc_t)func, arg, flags);
 }
@@ -364,6 +368,8 @@
 {
        KASSERT((flags & ~PFIL_ALL) == 0);
 
+       ASSERT_SLEEPABLE();
+
        for (u_int i = 0; i < __arraycount(pfil_flag_cases); i++) {
                const int fcase = pfil_flag_cases[i];
                pfil_listset_t *pflistset;
@@ -383,6 +389,9 @@
        pfil_listset_t *pflistset;
 
        KASSERT(flags == PFIL_IFADDR || flags == PFIL_IFNET);
+
+       ASSERT_SLEEPABLE();
+
        pflistset = pfil_hook_get(flags, ph);
        (void)pfil_list_remove(pflistset, (pfil_polyfunc_t)func, arg);
        return 0;



Home | Main Index | Thread Index | Old Index