Source-Changes-HG archive

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

[src/trunk]: src/sys/net/npf Fix locking issue: npf_default_pass needs to be ...



details:   https://anonhg.NetBSD.org/src/rev/4ba1b4fc2c36
branches:  trunk
changeset: 958941:4ba1b4fc2c36
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Jan 25 17:17:19 2021 +0000

description:
Fix locking issue: npf_default_pass needs to be called with the config lock
held.

diffstat:

 sys/net/npf/npf_os.c |  12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diffs (30 lines):

diff -r 3a4b1fcf25ba -r 4ba1b4fc2c36 sys/net/npf/npf_os.c
--- a/sys/net/npf/npf_os.c      Mon Jan 25 16:21:41 2021 +0000
+++ b/sys/net/npf/npf_os.c      Mon Jan 25 17:17:19 2021 +0000
@@ -33,7 +33,7 @@
 
 #ifdef _KERNEL
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: npf_os.c,v 1.19 2020/08/18 07:53:24 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_os.c,v 1.20 2021/01/25 17:17:19 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "pf.h"
@@ -321,8 +321,16 @@
 bool
 npf_autounload_p(void)
 {
+       if (npf_active_p())
+               return false;
+
        npf_t *npf = npf_getkernctx();
-       return !npf_active_p() && npf_default_pass(npf);
+
+       npf_config_enter(npf);
+       bool pass = npf_default_pass(npf);
+       npf_config_exit(npf);
+
+       return pass;
 }
 
 /*



Home | Main Index | Thread Index | Old Index