From nobody Mon Jun 8 20:47:35 2026 X-Original-To: dev-commits-src-main@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 4gZ3yH4Zsnz6gjxm for ; Mon, 08 Jun 2026 20:47:35 +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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gZ3yH3mbdz3vX0 for ; Mon, 08 Jun 2026 20:47:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780951655; 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=bB/O0Sk0ulaoyPYXWkJPm7kb2uf+Vufbf9bFmpxYhRI=; b=qMtkVPjxOyrZqnZ2TBcwmCNz/S3Nv1/SJ5Yu1MtQB2FdIq23XBQuyVDC0R2pg48IhKK7bc /VBM97q8NUThAoBX8GHGfmmRhdOiOy9abVUZhOy/1xIFk9SWG+DNETc7fZeLRbzRKrjNYD dl4lqErZwXzjjh0h+g477zgByPXk3Feya4nTxAn7HM2aeokzR0yBZiL37OpNR/pxGVSxiz LLrvVxzNzU5jTG6SC78Ch85HoMcoH77i5fwCkGid8qudSC1yDdH2X2QuTZ0uUoe6dPAbQi SJubcVFoL3prKI5bWC8cDToZXuui5mEScEA8XBhek83RpVMoeM/a/Zy9BF/3sg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780951655; a=rsa-sha256; cv=none; b=l2sA5sTQfEef1RY3GpJcgsws60Z1PoDTDsonV6hifnOFmkDMR8tseTwxu9eNISRfByMeEo qh/mogRN5IVZYyfnxkTHB9tTn3vx94AWQbxHcFZURsxDOZiOfxXT3Kla3h9kpnRv9FvupW MQVHF/K53o7+k1pJsoN1uLeRlhCCGKUbjcSbETSpGxux2+QpvFb5I3+/eTqgQ1va/vdvDw dw3yTR87rkt8yVt5O3i5nZ4Xz5HRFN6gmG2npt6SOcOf0//vGgssqxh4FrxwjP7KzoBWBE 1LerYzjizsGn2Ix+Px2IWkXHJ/p/gdfVLZ4+7J26kR6fGPG6KEPg/+/A0+68lQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780951655; 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=bB/O0Sk0ulaoyPYXWkJPm7kb2uf+Vufbf9bFmpxYhRI=; b=HNfkrprwd/jKY7DSwNS0cxgNS7Z86JYmMez0vsJGx6xiZ0ffaZU8GS4VTy1zP4kuiSgjAg Isqv2Kp5xqBK1jDwbZQg0ItV228PSRfit3bwODb7b7BcpAUdT1rslzOlwEcnOUgf3ObK3A rlYwMSpQJIWL3J4G0Q4GgLJlaHvDK+Nbv/EJag9zy1ZuEL368WaLVGhPnhcKZV/z8+TWKc Ld1ZikSvmZ2NZDhzBNGJE3UeEcWwhQFgaWvaHuVyNFK1A50yj/ORioPvlPRvLSpTcPlpkN bYl7aSgo5T2gV2BseugdUCd1d0b+Iv7OVbcOu8S8866bPe6/9lhd6XTZvoB/VQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gZ3yH32Qlz140c for ; Mon, 08 Jun 2026 20:47:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 4434b by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 08 Jun 2026 20:47:35 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: b16c731b0191 - main - ipfw nat: Add assertion that mbuf is not a chain List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org List-Id: 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b16c731b0191d6c47de46a3c6057b0c5ec0dd420 Auto-Submitted: auto-generated Date: Mon, 08 Jun 2026 20:47:35 +0000 Message-Id: <6a272a67.4434b.4d38b685@gitrepo.freebsd.org> The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=b16c731b0191d6c47de46a3c6057b0c5ec0dd420 commit b16c731b0191d6c47de46a3c6057b0c5ec0dd420 Author: Ed Maste AuthorDate: 2026-06-05 21:00:07 +0000 Commit: Ed Maste CommitDate: 2026-06-08 20:47:24 +0000 ipfw nat: Add assertion that mbuf is not a chain Discarding m_free's return value will result in an mbuf leak if the mbuf was in a chain. In general we should use m_freem if the mbuf may be in a chain, or assert that the return was NULL. There will not be a chain here due to m_megapullup, so add an assert. Reviewed by: ae Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D57479 --- sys/netpfil/ipfw/ip_fw_nat.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sys/netpfil/ipfw/ip_fw_nat.c b/sys/netpfil/ipfw/ip_fw_nat.c index e816c7bd95eb..6ebde03fe2e3 100644 --- a/sys/netpfil/ipfw/ip_fw_nat.c +++ b/sys/netpfil/ipfw/ip_fw_nat.c @@ -291,7 +291,7 @@ free_nat_instance(struct cfg_nat *ptr) static int ipfw_nat(struct ip_fw_args *args, struct cfg_nat *t, struct mbuf *m) { - struct mbuf *mcl; + struct mbuf *mcl, *mfree __diagused; struct ip *ip; /* XXX - libalias duct tape */ int ldt, retval, found; @@ -396,7 +396,8 @@ ipfw_nat(struct ip_fw_args *args, struct cfg_nat *t, struct mbuf *m) (retval == PKT_ALIAS_IGNORED && (t->mode & PKT_ALIAS_DENY_INCOMING) != 0)))) { /* XXX - should i add some logging? */ - m_free(mcl); + mfree = m_free(mcl); + MPASS(mfree == NULL); args->m = NULL; return (IP_FW_DENY); }