summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2008-07-27 20:48:22 +0000
committermav <mav@FreeBSD.org>2008-07-27 20:48:22 +0000
commitb6bbe78d99e70e1311f9797f0d9ec6786fea8cbe (patch)
treed14a3563a0fa5a1f78c45a7d7d46ed9a20b22def
parent8a791bfa67adaa4e1400a16d0da9a28131f53bcf (diff)
downloadFreeBSD-src-b6bbe78d99e70e1311f9797f0d9ec6786fea8cbe.zip
FreeBSD-src-b6bbe78d99e70e1311f9797f0d9ec6786fea8cbe.tar.gz
According to in_pcb.h protocol binding information has double locking.
It allows access it while list travercing holding only global pcbinfo lock.
-rw-r--r--sys/netinet/ip_divert.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c
index 158a9e7..a509151 100644
--- a/sys/netinet/ip_divert.c
+++ b/sys/netinet/ip_divert.c
@@ -268,9 +268,9 @@ divert_packet(struct mbuf *m, int incoming)
nport = htons((u_int16_t)divert_info(mtag));
INP_INFO_RLOCK(&divcbinfo);
LIST_FOREACH(inp, &divcb, inp_list) {
- INP_RLOCK(inp);
/* XXX why does only one socket match? */
if (inp->inp_lport == nport) {
+ INP_RLOCK(inp);
sa = inp->inp_socket;
SOCKBUF_LOCK(&sa->so_rcv);
if (sbappendaddr_locked(&sa->so_rcv,
@@ -283,7 +283,6 @@ divert_packet(struct mbuf *m, int incoming)
INP_RUNLOCK(inp);
break;
}
- INP_RUNLOCK(inp);
}
INP_INFO_RUNLOCK(&divcbinfo);
if (sa == NULL) {
OpenPOWER on IntegriCloud