From nobody Mon Sep 30 18:03:05 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 4XHTSn6J4Jz5XRWB; Mon, 30 Sep 2024 18:03:05 +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 4XHTSn5fg9z4pKn; Mon, 30 Sep 2024 18:03:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727719385; 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=p2U8awywpzZnZcYzNyzM6jIBGCoJtjB7IAkPEJwNX4c=; b=FcdAzLi8V2+Sn0n2Ptqphmy8p0YXKN7DTGcQ0hrrdF5UDZRsbPnUziJRs57QVvReTQ/G28 9JJEo1mkxUM84ziHTXk624Mc3ZZEJppUW575kYyEbSKkqcjvlNZ5IelUUdWartPpwNiOFj yLI8bzDixmuSKFdgvj67h3A1r6YKvCm41umIYIyzxhMmuKzu66VdkJc46x9qhwJO5MiLQZ sPCvtFEhnPNeoKvoFhzFwFWLhM11tQ7FY81cQ2lWoWcIyw4JKGciGS+nMUppUXQhIOQRYD kd1PNprCkrFu84SgFoARkWq9Tf8TSOLJ9NSleETj4sN7UFTW6i41ZaH/5U5/Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727719385; 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=p2U8awywpzZnZcYzNyzM6jIBGCoJtjB7IAkPEJwNX4c=; b=u6PGdlzYw3pOIlocLldqGWvG6AbGqZrEXXBioy2wG9IT5msQRF4nDKWSFESvqm3P3fP+JH nSOoAowi4FID8/zY21jP4uSAG8a/P5iRyc60hgtuAsIeDVfdCjcrQTK1b19djYClivcxcm DjG0JY6IoGsSyjwvlajuWwh7x03wk+0nvS+nA10tfeIoaOK105QeXNjDGrPoKUJ6vMBzSP mdl2CGGsVITve76ejs34pAixfiCb2hjrDdVd7XCIeLuWSH/KQDWtCABDGb+enzbUU3fOYh iQvF7iG0CURqIbFlV9+nbtyhrDMw9WyDCTSSQxykueaYbRVX3dmgDvXnvSIQUQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1727719385; a=rsa-sha256; cv=none; b=Zgh0uwfQejZitrkhL3wHGd+XASNZWO2azJh0Bp0YRTLH6mBsmw5Y7YORGUiGhLx9FZDknF T5JVsfcujKCyZc7RW5Bp71Q9r8Xav87L2e1dvFH8k66zMhZ53dcJ+/1l3q69stxAtiBZe1 AtRvbUgGJIEpba3a5BAWIUY/2Mfm58jXmscw17qiUlj/iLAIbgL6ej/bZd0wqcJ5mW1xFA 9R020fGEU3jHtMacmOPK5JCUgtI0baUC9LQ0zuZLRY1cTTdJ7xekAvqHuaxBwDc9tFRio4 wuywZYJWu0FQAgxKmqKZvl7sg+qPZsvY+pLFyE1MMni58ARjvpsGsEe+mexWyg== 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 4XHTSn5FdSz13mh; Mon, 30 Sep 2024 18:03:05 +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 48UI35eF082492; Mon, 30 Sep 2024 18:03:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 48UI35ii082489; Mon, 30 Sep 2024 18:03:05 GMT (envelope-from git) Date: Mon, 30 Sep 2024 18:03:05 GMT Message-Id: <202409301803.48UI35ii082489@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Michael Tuexen Subject: git: 01eb635d1295 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 01eb635d12953e24ee5fae69692c28e4aab4f0f6 Auto-Submitted: auto-generated The branch main has been updated by tuexen: URL: https://cgit.FreeBSD.org/src/commit/?id=01eb635d12953e24ee5fae69692c28e4aab4f0f6 commit 01eb635d12953e24ee5fae69692c28e4aab4f0f6 Author: Michael Tuexen AuthorDate: 2024-09-30 18:00:04 +0000 Commit: Michael Tuexen CommitDate: 2024-09-30 18:00:04 +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 MFC after: 1 week Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D46839 --- 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 04a964cf40cc..cb175d07c4d2 100644 --- a/sys/netinet/tcp_syncache.c +++ b/sys/netinet/tcp_syncache.c @@ -1604,8 +1604,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; } } @@ -1775,6 +1773,8 @@ tfo_expanded: #ifdef MAC mac_syncache_destroy(&maclabel); #endif + if (ipopts) + (void)m_free(ipopts); } return (rv); }