diff options
author | Vitaliy Makkoveev <mvs@cvs.openbsd.org> | 2023-04-22 20:51:57 +0000 |
---|---|---|
committer | Vitaliy Makkoveev <mvs@cvs.openbsd.org> | 2023-04-22 20:51:57 +0000 |
commit | 332b5f6a223795c19b3cb8fe956734d16bcd6720 (patch) | |
tree | 5e0f687eadb43c42279e5d222429080948c77057 /sys/net/pfkeyv2.c | |
parent | 799345b0103d9724a7ff0e39fc442f61e53e1766 (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.c | 6 |
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 |