From nobody Mon Jan 22 18:22:46 2024 X-Original-To: dev-commits-src-branches@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 4TJdqq39Ytz57wh6; Mon, 22 Jan 2024 18:22:47 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TJdqq0wZSz4sP3; Mon, 22 Jan 2024 18:22:47 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705947767; 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=CtY0u+oduQ7z40+qDfHuBKdEV4jWFdLEaspv5KkyzQs=; b=rYMLnVu4xYOhHLxStqU62dc06t2/Ryg+k/xo4TA3v2HRTl7/EMkZfov8hwjID9zjEZysof bUiASbCvyRXJAd+bikDmgJWv4LmUzQ3L3Tq35QX1tEN7BVHAXu1XKZkGsbhiQJEGzIUvTd 29ARSqBIvq+gZBHhAmxlWfjfeeoMQh0ueJyo6UOM5osWzt+8JYxFMIGvncXmNdLVsEvWnS 8utL0z8K35V3oHbCHCrh9IYggj8BbmPVC9IJi/KkOFdF6jLlNlLvo9b7qzAs2efvPuTt/z 4oFKVP0m7vwNG+DyI5eg2ZHQh/UR/hEiCu8aQAVEIrkAjZ+e+WOrhB+p7wcTsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705947767; 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=CtY0u+oduQ7z40+qDfHuBKdEV4jWFdLEaspv5KkyzQs=; b=pPgplmuzlmT1It2eKuBFPJCPYQd2Vw5Pr5MF61XHhiU6Amsrs1uYFihX0l91bCDgHZx9da k/Xn3ZBK+5F8eJIArOXqkdKAj7EN5aH1et7KxY6eGXPcZ/ipKNLA60neAxr19KiTAixUMO UYzgYLAWRFRgMDOOPA+JkfIkHX+1hyBGvVsmOztddLvZ5zaGIS894CsLIJhJdGqy1NHvXK Nt+xp2hEArgtcr0286ibComG7BWDIUgj2aR8vKW1+xsEugycmBUvp6Irr1NBEy+OgaGRjG zSlibJsQejOFQ6405XbuiMGPX2M4MP7y+WuWWBBwPQ4h+hoFHEICEw3V0ZOcIA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1705947767; a=rsa-sha256; cv=none; b=Et/l7d+2nk112w+2o227Vje+OaBjFo1fjXItITytKAmTAPqXwoYbs4u9dubOepmT8uMdkO wrML3MIIvqzx1fV2tqVFgxoiE+DR/teSyjqU9sQHl1lqKu5SoncgPT3P52TkTJT0wA9NXH kXp3BoruLFJgbdAh+CWhiZLjcboxVTppn12Waascaa8pIa9eQiQEQ/foHyhSYAGmjbAiH6 kVjKE3P2ajkmgxY5H2YToZXQiR8B4XB0DNiNr3zevG4KYDtcOI3QgDIZdBj64pkN0+SdII anB+nLnK+HwrdJWaLybyj2sP+5hajTx9SbD4xUeeqXDKegb19W09yAt/rIhlTg== 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 4TJdqq01Vrz1CHS; Mon, 22 Jan 2024 18:22:47 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 40MIMkFq009843; Mon, 22 Jan 2024 18:22:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40MIMkhu009840; Mon, 22 Jan 2024 18:22:46 GMT (envelope-from git) Date: Mon, 22 Jan 2024 18:22:46 GMT Message-Id: <202401221822.40MIMkhu009840@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Gleb Smirnoff Subject: git: 166bc357c6a4 - stable/13 - routing: plug mbuf leak for the packets hitting IPv6 blackhole route List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 166bc357c6a4813e7c03ecaea54d7ef6508e7132 Auto-Submitted: auto-generated The branch stable/13 has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=166bc357c6a4813e7c03ecaea54d7ef6508e7132 commit 166bc357c6a4813e7c03ecaea54d7ef6508e7132 Author: Alexander V. Chernikov AuthorDate: 2023-05-17 09:06:04 +0000 Commit: Gleb Smirnoff CommitDate: 2024-01-22 18:21:34 +0000 routing: plug mbuf leak for the packets hitting IPv6 blackhole route Reported by: Dmitriy Smirnov Tested by: Dmitriy Smirnov MFC after: 1 day (cherry picked from commit b50e1465e88dcf5f6f008892d802df010e7029d1) --- sys/netinet6/ip6_forward.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/netinet6/ip6_forward.c b/sys/netinet6/ip6_forward.c index 7415c72d9aea..8c5748533a77 100644 --- a/sys/netinet6/ip6_forward.c +++ b/sys/netinet6/ip6_forward.c @@ -196,9 +196,12 @@ again: if (nh->nh_flags & (NHF_BLACKHOLE | NHF_REJECT)) { IP6STAT_INC(ip6s_cantforward); - if ((nh->nh_flags & NHF_REJECT) && (mcopy != NULL)) { - icmp6_error(mcopy, ICMP6_DST_UNREACH, - ICMP6_DST_UNREACH_REJECT, 0); + if (mcopy != NULL) { + if (nh->nh_flags & NHF_REJECT) { + icmp6_error(mcopy, ICMP6_DST_UNREACH, + ICMP6_DST_UNREACH_REJECT, 0); + } else + m_freem(mcopy); } goto bad; }