Skip to content

Commit eacb9c6

Browse files
Pull up following revision(s) (requested by joe in ticket #52):
sys/net/npf/npf_socket.c: revision 1.4 hold locks in socket access in npf PR kern/59681
1 parent 04e0d83 commit eacb9c6

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

sys/net/npf/npf_socket.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
#ifdef _KERNEL
2727
#include <sys/cdefs.h>
28-
__KERNEL_RCSID(0, "$NetBSD: npf_socket.c,v 1.3 2025/06/02 13:19:27 joe Exp $");
28+
__KERNEL_RCSID(0, "$NetBSD: npf_socket.c,v 1.3.2.1 2025/10/13 09:22:02 martin Exp $");
2929

3030
#include <sys/param.h>
3131
#include <sys/types.h>
@@ -92,6 +92,7 @@ npf_socket_lookup_rid(npf_cache_t *npc, get_rid_t get_rid, uint32_t *rid, int di
9292

9393
KASSERT(npf_iscached(npc, NPC_IP46));
9494

95+
mutex_enter(softnet_lock);
9596
if (npf_iscached(npc, NPC_IP4)) {
9697
so = npf_ip_socket(npc, dir);
9798
#if defined(INET6)
@@ -104,6 +105,8 @@ npf_socket_lookup_rid(npf_cache_t *npc, get_rid_t get_rid, uint32_t *rid, int di
104105
return -1;
105106

106107
*rid = get_rid(so->so_cred);
108+
mutex_exit(softnet_lock);
109+
107110
return 0;
108111
}
109112

@@ -225,6 +228,7 @@ npf_ip6_socket(npf_cache_t *npc, int dir)
225228
if (in6p == NULL)
226229
return NULL;
227230
}
231+
228232
so = in6p->inp_socket;
229233
return so;
230234
}

0 commit comments

Comments
 (0)