From owner-dev-commits-src-all@freebsd.org Tue Jun 22 23:31:38 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8CAC2664DDE; Tue, 22 Jun 2021 23:31:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4G8jMt37pZz4gS1; Tue, 22 Jun 2021 23:31:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 53DA319BBC; Tue, 22 Jun 2021 23:31:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 15MNVcvo016398; Tue, 22 Jun 2021 23:31:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 15MNVce0016397; Tue, 22 Jun 2021 23:31:38 GMT (envelope-from git) Date: Tue, 22 Jun 2021 23:31:38 GMT Message-Id: <202106222331.15MNVce0016397@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: a7f6c6fd94d6 - main - toe: Read-lock the inp in toe_4tuple_check(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a7f6c6fd94d658b9e3f6f9bec02edfefb1a3d652 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Jun 2021 23:31:38 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=a7f6c6fd94d658b9e3f6f9bec02edfefb1a3d652 commit a7f6c6fd94d658b9e3f6f9bec02edfefb1a3d652 Author: John Baldwin AuthorDate: 2021-06-22 23:31:01 +0000 Commit: John Baldwin 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); } }