From nobody Thu Oct 31 13:57:43 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 4XfQYM3kpBz5blQM; Thu, 31 Oct 2024 13:57:43 +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 4XfQYM3Bz1z40M1; Thu, 31 Oct 2024 13:57:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730383063; 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=YuwsCDnJZSl6+5NoyHOxwdzdA1RyDfEBVI7gCBLM1Q0=; b=XK6r9pcAKKC21zDX27cCPR65CgwMcBH9IosY/dpcXHsWHULVQDlzqSCuY1NOArxGTrzoN2 gGT0m+OvXGU7lLrC36ZFiV/K026ercRBSJsBYKd3jo5gUEbOk9hRx0chOgNnqnJ1BJAX5L Yaz6tSS16Svh6rl7iYbR7QLsjj6PbQOGzjnvAUWRKvRlX1kfSafVJWT05gnf4D6mY7WcT8 CxyQG9/uZV2PqvwWO356nko6NJLibbvMq2K5rmyvrRPRt1YBxObev1qCEgDoD1cUGhFaGA arV1OYN84U5PyviAzbgEL0gESQivOIbSy8Mqx1HqAeUf/iUTbITXq5TQelOufQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1730383063; 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=YuwsCDnJZSl6+5NoyHOxwdzdA1RyDfEBVI7gCBLM1Q0=; b=es6iRI5QQ/rjyePr2K5W7zor2eiteF56ebTUvyhopVS5f0jiuXmpvPzKJxycYVRgo4K+mp FR62VJbojxUnFrPM6iL21XMO6iGDY4vBpdFIOkkd5nsF0S0L0tVeEPtOkqsp4zNO1RHaVt 1TLQIop/LYAJadTGG0zB/C/gJIhSeQyiVPRkxTIKCjN/Rdfmcbd5yWoXH/4EdgSxM9MCMy MKObBDhCdWZGeliBOdwMBJ/ivv2vpaaHBEoFUnxr5KzF4I7BUf8DLq7sdP4TzU70NUQKnu LGlvZa23ZhKBMLLP6jJ8mtpViNJzuQsAs2q6XN7sFYQz9vvZZAZdqcpqfr2COA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1730383063; a=rsa-sha256; cv=none; b=xORZtZmle0xfnErvOrMcK/+YGNj31moJoR9WqJ1/B4D6sUaRkQ7w4bET92uLi4ew3zgEmc jod8lvBC5i71scVcxKyeyIxYdAAyOUSBd8a8/gD/eupxVFf0/ZzFQ0mGpqv7MD988tjsGw c9xdbIDjQIi+E17G300CxBLEEyGzs/z4ej24pGjetOK4EIyGgzEhw9Bhl329M44LNqtc9l mb4YBTNCLa/uPUfD1k8DVvjHlXPCdn5QzwFHdyova5y143UIBl5/ZKW5B/k2DSzN11RHbo yDFNoaQsJE/Td2zd69GnLKqRC8NM+mwGfYAOXfUSlTTWs0Z6kj1EYTfeAA2Qww== 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 4XfQYM2pM5zfJr; Thu, 31 Oct 2024 13:57:43 +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 49VDvhJJ029532; Thu, 31 Oct 2024 13:57:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49VDvhVx029529; Thu, 31 Oct 2024 13:57:43 GMT (envelope-from git) Date: Thu, 31 Oct 2024 13:57:43 GMT Message-Id: <202410311357.49VDvhVx029529@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: 67e469299821 - stable/14 - 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/14 X-Git-Reftype: branch X-Git-Commit: 67e469299821c9b02b26e1b379f2b1754fee536c Auto-Submitted: auto-generated The branch stable/14 has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=67e469299821c9b02b26e1b379f2b1754fee536c commit 67e469299821c9b02b26e1b379f2b1754fee536c Author: Michael Tuexen AuthorDate: 2024-09-30 18:00:04 +0000 Commit: Michael Tuexen CommitDate: 2024-10-31 11:36:12 +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 c0c571fb76c2..6d171b2b7ea6 100644 --- a/sys/netinet/tcp_syncache.c +++ b/sys/netinet/tcp_syncache.c @@ -1614,8 +1614,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; } } @@ -1785,6 +1783,8 @@ tfo_expanded: #ifdef MAC mac_syncache_destroy(&maclabel); #endif + if (ipopts) + (void)m_free(ipopts); } return (rv); }