From nobody Tue Jun 17 15:50:45 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bMBD62BBsz5yTFN; Tue, 17 Jun 2025 15:50:46 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bMBD60DLcz3pjS; Tue, 17 Jun 2025 15:50:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750175446; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DxduWcxV/HhgJZ7h9ojc2iIo9Ly3HL2cFfeL7NE5+CY=; b=b2X8wUr3kWCvunEIR8+7VstlY2+SAQ3HtYLSY2oIYUOl7eINxQ6Ix0d2w7Eqj68i+Al35U IRzE9t2+TRdWumYn46TCFexrfkJQ7y57IqZtp1ERSWcHWDk2UCn0tbQWSdfYozJ48x5waO gUmhLoVHPeIa3Ftd9QzALnuks0vKnqpdzWoqtZhecScUKJUfLcq1dXKV8SoJLAoIkR8CBP mgxxzMli7S+inNfBITkck/dThMNLdwxVrpZ8mC3XFF9JoDyv0C31qG/tBT9tf1oXka2/LQ 2HbLfAu1xS6yg7Kno7UZHPF5MsFcnI1WTjrGmN01G90q0d5aqTc5MH07vBhFwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750175446; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DxduWcxV/HhgJZ7h9ojc2iIo9Ly3HL2cFfeL7NE5+CY=; b=uwOvXy15i4uvHUmCBWXg/R8OK1VkkOUGPJYB3aGzkR8OJxjRp47y4ie8EULIeCW5zipNqi NIuzyLa3kC12XYIEIowHHiodlI7pVPyU6CfXkpR5PAASTI2e3VHYFz0NRqU3VyXFOB7p27 s2hfxiurA2IgyMDnZq08Lauu+tWNvTWxfWOGqkvWvYFnA68rauAFtAtnITc1Kkt57EXGw5 vANgIdbgwhMtVYs7EjAheJj3w6HP9HJR03dzzS4hf0dAWZ6PHid+vNB8hO7tRq/ZWLHwYi A4b7LbJCjrtrvthTf5I6pb+6DAE12jY+FpKB/dfse80qxKzSP3I0GVmqqXUcXQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1750175446; a=rsa-sha256; cv=none; b=H35yvQRJfXC99WsjgbaClTCgHM19SfLaJLxA4WIFN/sB022xGrIjh3zjxSnCqelvFitmaX 3ArU8k951BSrFdhWAeMXIE8VSvJQ+dx9p2HyuRlR+UOZuwt+fERTk2Xy1j3LwnTxWM9ODv 73fZ4JttcF72wwsY8CA3m1khegmDNYqJTFZ5ybfYbvVPzPNdmMrd9/i+hkah3uY9c+dXut UHLI+YGjabyfKPOz9aKmDINYGN2BoB2/UOHz1Ee0mVXunD4/qfMVPpT7t8FOyUygJSjwKr Fef2bnJoftu8HKB55ToTSFtdx61uphNxLyNpeTjWXlatrF5GPd5ZuPcITFq4+Q== 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 4bMBD56v9lzqTK; Tue, 17 Jun 2025 15:50:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55HFojdU029560; Tue, 17 Jun 2025 15:50:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55HFojQ1029557; Tue, 17 Jun 2025 15:50:45 GMT (envelope-from git) Date: Tue, 17 Jun 2025 15:50:45 GMT Message-Id: <202506171550.55HFojQ1029557@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 0809d26de24d - main - tcp: unlock before syncookie_expand() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0809d26de24defdc4a2ae161357566c02dc163d1 Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=0809d26de24defdc4a2ae161357566c02dc163d1 commit 0809d26de24defdc4a2ae161357566c02dc163d1 Author: Gleb Smirnoff AuthorDate: 2025-06-17 15:50:23 +0000 Commit: Gleb Smirnoff CommitDate: 2025-06-17 15:50:23 +0000 tcp: unlock before syncookie_expand() The function doesn't need a lock on sch. It uses the pointer as value for the SipHash calculation. Reviewed by: tuexen Differential Revision: https://reviews.freebsd.org/D50898 --- sys/netinet/tcp_syncache.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c index f7dfed78b0eb..24ef871c953a 100644 --- a/sys/netinet/tcp_syncache.c +++ b/sys/netinet/tcp_syncache.c @@ -1112,14 +1112,13 @@ syncache_expand(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th, s, __func__); goto failed; } + if (locked) + SCH_UNLOCK(sch); bzero(&scs, sizeof(scs)); if (syncookie_expand(inc, sch, &scs, th, to, *lsop, port)) { sc = &scs; TCPSTAT_INC(tcps_sc_recvcookie); - } - if (locked) - SCH_UNLOCK(sch); - if (sc == NULL) { + } else { if ((s = tcp_log_addrs(inc, th, NULL, NULL))) log(LOG_DEBUG, "%s; %s: Segment failed " "SYNCOOKIE authentication, segment rejected "