summaryrefslogtreecommitdiff
path: root/sys/net/pfkeyv2.c
diff options
context:
space:
mode:
authorVitaliy Makkoveev <mvs@cvs.openbsd.org>2023-04-22 20:51:57 +0000
committerVitaliy Makkoveev <mvs@cvs.openbsd.org>2023-04-22 20:51:57 +0000
commit332b5f6a223795c19b3cb8fe956734d16bcd6720 (patch)
tree5e0f687eadb43c42279e5d222429080948c77057 /sys/net/pfkeyv2.c
parent799345b0103d9724a7ff0e39fc442f61e53e1766 (diff)
Call pfkeyv2_sysctl_policydumper() with shared netlock. It performs
read-olny access to netlock protected data, so the radix tree will not be modified during spd_table_walk() run. Also change netlock assertion within spd_table_add() and ipsec_delete_policy() to exclusive. These are correlating functions which modifies radix tree, so make us sure spd_table_walk() run with shared netlock is safe. Feedback and ok by bluhm@
Diffstat (limited to 'sys/net/pfkeyv2.c')
-rw-r--r--sys/net/pfkeyv2.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/net/pfkeyv2.c b/sys/net/pfkeyv2.c
index 4aab05371c2..cdc5ce2b231 100644
--- a/sys/net/pfkeyv2.c
+++ b/sys/net/pfkeyv2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfkeyv2.c,v 1.255 2023/01/08 10:26:36 mvs Exp $ */
+/* $OpenBSD: pfkeyv2.c,v 1.256 2023/04/22 20:51:56 mvs Exp $ */
/*
* @(#)COPYRIGHT 1.1 (NRL) 17 January 1995
@@ -2711,10 +2711,10 @@ pfkeyv2_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp,
break;
case NET_KEY_SPD_DUMP:
- NET_LOCK();
+ NET_LOCK_SHARED();
error = spd_table_walk(rdomain,
pfkeyv2_sysctl_policydumper, &w);
- NET_UNLOCK();
+ NET_UNLOCK_SHARED();
if (oldp)
*oldlenp = w.w_where - oldp;
else