diff options
author | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2022-08-22 10:37:28 +0000 |
---|---|---|
committer | Alexander Bluhm <bluhm@cvs.openbsd.org> | 2022-08-22 10:37:28 +0000 |
commit | 7b63f372dc76ea2dad97ef9197710e5e653f6215 (patch) | |
tree | 8aaa6056ca17d7cee070c8d2a567344a6b12e463 /sys/netinet6/in6_pcb.c | |
parent | 43e1b15fa12ce7c8b1b58bdb5c3f9daacc185fbe (diff) |
Use rwlock per inpcb table to protect notify list. The notify
function may sleep, so holding a mutex is not possible. The same
list entry and rwlock is used for UDP multicast and raw IP delivery.
By adding a write lock, exclusive netlock is no longer necessary
for PCB notify and UDP and raw IP input.
OK mvs@
Diffstat (limited to 'sys/netinet6/in6_pcb.c')
-rw-r--r-- | sys/netinet6/in6_pcb.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index 43a6e739e28..471a9614fea 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_pcb.c,v 1.119 2022/08/08 12:06:31 bluhm Exp $ */ +/* $OpenBSD: in6_pcb.c,v 1.120 2022/08/22 10:37:27 bluhm Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -387,8 +387,6 @@ in6_pcbnotify(struct inpcbtable *table, struct sockaddr_in6 *dst, u_int32_t flowinfo; u_int rdomain; - NET_ASSERT_LOCKED_EXCLUSIVE(); - if ((unsigned)cmd >= PRC_NCMDS) return; @@ -430,6 +428,7 @@ in6_pcbnotify(struct inpcbtable *table, struct sockaddr_in6 *dst, SIMPLEQ_INIT(&inpcblist); rdomain = rtable_l2(rtable); + rw_enter_write(&table->inpt_notify); mtx_enter(&table->inpt_mtx); TAILQ_FOREACH(inp, &table->inpt_queue, inp_queue) { if ((inp->inp_flags & INP_IPV6) == 0) @@ -513,6 +512,7 @@ in6_pcbnotify(struct inpcbtable *table, struct sockaddr_in6 *dst, (*notify)(inp, errno); in_pcbunref(inp); } + rw_exit_write(&table->inpt_notify); } struct inpcb * |