From nobody Thu Oct 31 16:58:29 2024 X-Original-To: dev-commits-src-all@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 4XfVYx3YPQz5c229; Thu, 31 Oct 2024 16:58:29 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XfVYx2k0dz4lV5; Thu, 31 Oct 2024 16:58:29 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730393909; 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=UIhUPp5tXoQqKxlxmnURdXQLCx0qY7/9NYbFkVXTHLE=; b=Xuv0mKLe2kOkRclQJ0vmZJBduEZWcYWlKcTDRst/TkgeDsqVZDzuji92jZWEvGgCoeswHw fSs0Q7tGDblMcwMYGlf/KzGMjMReO8cmVACw05kYPJrbU+AKZxIbn3VDM43x05ZKLXCHo4 2+ciNnJeDCsLy4R1GCQM/shM2XSOK6Zhfcve3jgp98N1VBgOmn/Mj4q20DWq6aWlOjfWVI OmNtDPefvIgNONb+fad8ohsA25DYsvtT+Wcqe9ZOIeZpa3mVA4Y1i2U3a0JX0OSnpiWIOg LP+n+EsMtlZye75mnFLrPsbSt92rBWoVwRC6a7sPfYYSWReDXXjZCX6yLx/e8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730393909; 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=UIhUPp5tXoQqKxlxmnURdXQLCx0qY7/9NYbFkVXTHLE=; b=vauXokaDH3b964ERJ5s9leYr+Ev7yMmFc4bYz8vhQq0Wna04GFbWltbxq6+PMQ/OvZST9K QcjQGgZxqeuAymYxyPMBi0PBvrJS9avdYHT6bT6rQBlcLTUQio/E+AAfFfI+SqnF3n9OVi V55R0/9C/fhyw6caqQTCOf4H87P+Bb5+b9iTZWEF7/62UACw8gNKYl0+VhLJpqVjx7FdHq swnpsBDHybJb0oEq5iyqJ0BD1XPw0+tI0ehnL/YBKps+J9JhPjOw2cTxJ4ojJbxZCaF40S ociyLskv9RJB/uhqrLPwxyJfN9Vx4EK7q+CxEW0z7ZmlKlpKdc451UX7pRlNaQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730393909; a=rsa-sha256; cv=none; b=EDzkxRXdnuZvBL9H3lXsDHrIMUawy3UV0IHVVWNVizj9Cr189nvl4aQMa4vsaJS9u+IW0c ZjvKhW4QL0UbF9a12shHtprTgW/4fdcS8ExiDqDT5KriHfWfYXD/tlFkjw6Q1tUNatcLy0 wv3tUx5LU/bad/NV3OgbV6bcJb+1IDUiystGlzJPIEL41bXB3JbaJEByFsRo7q7ys/VOfO xAyt+UvXg9MigYXiJv2vjHhktpVuHwMguXBo1yrWMGLttAHZpi8+awQ2TsbTPyYfaDj3Oj WV/wGIirbw4t84YtHy1rIhnEqUkpBTVNsmENG1nH9b+P92YlHji+bgT1NPqrnw== 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 4XfVYx2GHlzl4f; Thu, 31 Oct 2024 16:58:29 +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 49VGwTuo071932; Thu, 31 Oct 2024 16:58:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49VGwTdh071929; Thu, 31 Oct 2024 16:58:29 GMT (envelope-from git) Date: Thu, 31 Oct 2024 16:58:29 GMT Message-Id: <202410311658.49VGwTdh071929@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Michael Tuexen Subject: git: 7174ef705c03 - stable/13 - tcp: improve mbuf handling when processing SYN segments List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: tuexen X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 7174ef705c036b5a47e4d4903f57ddc005465b0c Auto-Submitted: auto-generated The branch stable/13 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=7174ef705c036b5a47e4d4903f57ddc005465b0c commit 7174ef705c036b5a47e4d4903f57ddc005465b0c Author: Michael Tuexen AuthorDate: 2024-09-30 18:00:04 +0000 Commit: Michael Tuexen CommitDate: 2024-10-31 16:57:58 +0000 tcp: improve mbuf handling when processing SYN segments When the sysctl-variable net.inet.ip.accept_sourceroute is non-zero, an mbuf would be leaked when processing a SYN-segment containing an IPv4 strict or loose source routing option, when the on-stack syncache entry is used or there is an error related to processing TCP MD5 options. Fix this by freeing the mbuf whenever an error occurred or the on-stack syncache entry is used. Reviewed by: markj, rscheff Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D46839 (cherry picked from commit 01eb635d12953e24ee5fae69692c28e4aab4f0f6) --- sys/netinet/tcp_syncache.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c index 4544788e8318..b5b7e90ebefd 100644 --- a/sys/netinet/tcp_syncache.c +++ b/sys/netinet/tcp_syncache.c @@ -1646,8 +1646,6 @@ syncache_add(struct in_conninfo *inc, struct tcpopt *to, struct tcphdr *th, ("%s: bucket unexpectedly unlocked", __func__)); SCH_UNLOCK(sch); - if (ipopts) - (void)m_free(ipopts); goto done; } } @@ -1810,6 +1808,8 @@ tfo_expanded: #ifdef MAC mac_syncache_destroy(&maclabel); #endif + if (ipopts) + (void)m_free(ipopts); } return (rv); }