From 3dc7ebf9ff0e1fb8614f7250776018fb36b4ba60 Mon Sep 17 00:00:00 2001 From: Jeffrey Hsu Date: Wed, 12 Feb 2003 23:55:07 +0000 Subject: [PATCH] in_pcbnotifyall() requires an exclusive protocol lock for notify functions which modify the connection list, namely, tcp_notify(). --- sys/netinet/in_pcb.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 776d70f9b79c..b0a66c617162 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -752,26 +752,26 @@ in_pcbnotifyall(pcbinfo, faddr, errno, notify) int s; s = splnet(); - INP_INFO_RLOCK(pcbinfo); + INP_INFO_WLOCK(pcbinfo); head = pcbinfo->listhead; for (inp = LIST_FIRST(head); inp != NULL; inp = ninp) { INP_LOCK(inp); ninp = LIST_NEXT(inp, inp_list); #ifdef INET6 if ((inp->inp_vflag & INP_IPV4) == 0) { - INP_UNLOCK(inp); + INP_UNLOCK(inp); continue; } #endif if (inp->inp_faddr.s_addr != faddr.s_addr || inp->inp_socket == NULL) { - INP_UNLOCK(inp); - continue; + INP_UNLOCK(inp); + continue; } - (*notify)(inp, errno); - INP_UNLOCK(inp); + if ((*notify)(inp, errno)) + INP_UNLOCK(inp); } - INP_INFO_RUNLOCK(pcbinfo); + INP_INFO_WUNLOCK(pcbinfo); splx(s); }