git: a7f6c6fd94d6 - main - toe: Read-lock the inp in toe_4tuple_check().
John Baldwin
jhb at FreeBSD.org
Tue Jun 22 23:31:38 UTC 2021
The branch main has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=a7f6c6fd94d658b9e3f6f9bec02edfefb1a3d652
commit a7f6c6fd94d658b9e3f6f9bec02edfefb1a3d652
Author: John Baldwin <jhb at FreeBSD.org>
AuthorDate: 2021-06-22 23:31:01 +0000
Commit: John Baldwin <jhb at FreeBSD.org>
CommitDate: 2021-06-22 23:31:01 +0000
toe: Read-lock the inp in toe_4tuple_check().
tcp_twcheck now expects a read lock on the inp for the SYN case
instead of a write lock.
Reviewed by: np
Fixes: 1db08fbe3ffa tcp_input: always request read-locking of PCB for any pure SYN segment.
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D30782
---
sys/netinet/toecore.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sys/netinet/toecore.c b/sys/netinet/toecore.c
index 5792298d2883..8eddb73d333c 100644
--- a/sys/netinet/toecore.c
+++ b/sys/netinet/toecore.c
@@ -390,19 +390,19 @@ toe_4tuple_check(struct in_conninfo *inc, struct tcphdr *th, struct ifnet *ifp)
if (inc->inc_flags & INC_ISIPV6) {
inp = in6_pcblookup(&V_tcbinfo, &inc->inc6_faddr,
inc->inc_fport, &inc->inc6_laddr, inc->inc_lport,
- INPLOOKUP_WLOCKPCB, ifp);
+ INPLOOKUP_RLOCKPCB, ifp);
} else {
inp = in_pcblookup(&V_tcbinfo, inc->inc_faddr, inc->inc_fport,
- inc->inc_laddr, inc->inc_lport, INPLOOKUP_WLOCKPCB, ifp);
+ inc->inc_laddr, inc->inc_lport, INPLOOKUP_RLOCKPCB, ifp);
}
if (inp != NULL) {
- INP_WLOCK_ASSERT(inp);
+ INP_RLOCK_ASSERT(inp);
if ((inp->inp_flags & INP_TIMEWAIT) && th != NULL) {
if (!tcp_twcheck(inp, NULL, th, NULL, 0))
return (EADDRINUSE);
} else {
- INP_WUNLOCK(inp);
+ INP_RUNLOCK(inp);
return (EADDRINUSE);
}
}
More information about the dev-commits-src-main
mailing list