From nobody Fri Nov 13 17:40:03 2026 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 4jR4Jz1VvVz70yMB for ; Fri, 13 Nov 2026 17:40:03 +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) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jR4Jz0qFFz4FV6 for ; Fri, 13 Nov 2026 17:40:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794591603; 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=tIbWY39NRJ6CR3b688cxWnMNxZdMJxgmGkM/4XACzEk=; b=V5e3bGISU1oZnJ2ahpBDthKBfvegwtHfWEUk9niGrEYbJg3k8Osat0Iwqk0JM7gHbggh1S nv3fmS+YEfbjco/HUS7YDak57RtXsVzyou66jjEZ+FTlQQwhEo8rkTDDCb/sZ++iC1sv+U SdJ75HXtqxJgi35dWscMo0ZnOmCySFajxQ7I9QIkqDAM/gsYhMR18T8BXagP+jbjsenq2s 4R84l2C3ZPY5hPYyf248Pymw9w7C/o4o6yiqF80NFbwviMGeR+pxETN48DYIcipA8PztdL GgrpLVTYD1ExjU0l5XXZo8S5qgsnb68Mk9lbNCme7zjtzIyYPCmEScaZJQbZxw== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794591603; b=yDIPdpYCUG2EDhQbjIWXh0v3ZY9a+AwGiXSkP5eG6Zg8HTw5nFgcUNICEr2wrP2kYGPp5X wao/OxHLsLwQQ/RLi+FgM6dPrCTqGsgM8e0ntZkd5QmCYY6Ej+mxbPlggcSubrCad5OOyo BGf2/KUC8Hyc+m5n9/FjFE9lUaIh7S2hfMK0qpywvd6efTi7SXnhBk2TcMnbNZSb5hxw54 ndpz8ONbIVDTirvCJwY/I3BCbm3dXZxUo3oL4WCl59GU9GL5VQzDzzrfG2IhyZi/yWanEv x3/SsKuJMQNGOwGEHK0Ztezbl3sUH5FmigT5QgXa2huhx29X0hHsPmqqcJAeEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794591603; 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=tIbWY39NRJ6CR3b688cxWnMNxZdMJxgmGkM/4XACzEk=; b=xlxeeSGFStNQmEQdYNlzc3qL6rXWIo4yAQI5rde082rT7GkRkNnSbqNeQm3xPoSjMlLy/s jUnA5zk1w/gisnajXrNTOabIT3UypokDklg8Cci2W5V9g9XZQtn9COej+nveBBIBoVxqVj 8epGjlLS6tDLaFBpu3ALtgF7On3hN7lTX7Dy2fCyIeWHCLM+XqqoWKq7XcXYNYazSBkU1h n1TPRcodL6wXgasSrPXSnB52OJv3D4EC11GXoCPKHhhFVzxG1xv/nS45WrUuM20qA2bvMl Kc8OpRSxMuAleo9SVYE4+AKyodTMllpfgb8l+5f4tDWc45itV7p+YjJ0wh2CoQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jR4Jz0V1Czls3 for ; Fri, 13 Nov 2026 17:40:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 187db by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 13 Nov 2026 17:40:03 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: R. Christian McDonald Subject: git: 3d88ee6af296 - main - ip6_forward: Free the ICMPv6 copy on all error paths List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rcm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3d88ee6af2961deefe7412b2e393aa0c05d4102c Auto-Submitted: auto-generated Date: Fri, 13 Nov 2026 17:40:03 +0000 Message-Id: <6af74b73.187db.7aa53878@gitrepo.freebsd.org> The branch main has been updated by rcm: URL: https://cgit.FreeBSD.org/src/commit/?id=3d88ee6af2961deefe7412b2e393aa0c05d4102c commit 3d88ee6af2961deefe7412b2e393aa0c05d4102c Author: R. Christian McDonald AuthorDate: 2026-11-13 17:37:42 +0000 Commit: R. Christian McDonald CommitDate: 2026-11-13 17:37:42 +0000 ip6_forward: Free the ICMPv6 copy on all error paths ip6_forward() keeps a copy of the start of the packet in case it has to send an ICMPv6 error. Every exit must either pass the copy to icmp6_error() or icmp6_redirect_output(), or free it. Three exits did neither and leaked the copy: - the destination scope check, when a packet would leave the zone of its destination address; - a packet that a pfil hook redirected to a local address, which is queued for local input; - a packet whose checksum has to be computed here and whose last header offset is not valid. Free the copy in these three cases. Reviewed by: tuexen, pouria Fixes: 8a006adb2441 ("Add support for IPv6 to ipfw fwd...") Fixes: bcb298fa9e23 ("sctp, tcp, udp: improve deferred computation...") MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D61509 --- sys/netinet6/ip6_forward.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/netinet6/ip6_forward.c b/sys/netinet6/ip6_forward.c index 0ebb51fd80f0..4b263e65a637 100644 --- a/sys/netinet6/ip6_forward.c +++ b/sys/netinet6/ip6_forward.c @@ -253,6 +253,7 @@ again: if (inzone != outzone) { IP6STAT_INC(ip6s_cantforward); IP6STAT_INC(ip6s_badscope); + m_freem(mcopy); goto bad; } @@ -362,7 +363,7 @@ again: m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID; #endif error = netisr_queue(NETISR_IPV6, m); - goto out; + goto freecopy; } /* Or forward to some other address? */ if ((m->m_flags & M_IP6_NEXTHOP) && @@ -400,8 +401,11 @@ pass: ~nh->nh_ifp->if_hwassist)) { int offset = ip6_lasthdr(m, 0, IPPROTO_IPV6, NULL); - if (offset < sizeof(struct ip6_hdr) || offset > m->m_pkthdr.len) + if (offset < sizeof(struct ip6_hdr) || + offset > m->m_pkthdr.len) { + m_freem(mcopy); goto bad; + } in6_delayed_cksum(m, m->m_pkthdr.len - offset, offset); m->m_pkthdr.csum_flags &= ~CSUM_DELAY_DATA_IPV6; }