From nobody Mon Nov 23 18:11:54 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 4jYDY66069z71DGx for ; Mon, 23 Nov 2026 18:11:54 +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 4jYDY63KrDz3QJP for ; Mon, 23 Nov 2026 18:11:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1795457514; 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=fHtlbxMa+0guUBY8Sw7nCz17ZjdtKNRMF11lQTbDlK4=; b=bpNdlkII1X5stq2eBOsJX/S1OXFSEIY/1Lq5UXtePRj5olV2Kc9ZpaC7MjYD7FuMxL1kFc gNZk4QqRdfZbWZCqLnpNkTZXdWugmphH1DRAg1GkEig5ePJEQfjx/dkvl+MpdTfdhp/W7j 1hdCpMSjB5YDVAUIgfmOp4SAjt/SxXwHNWkrxFAlD01WH2cYc1/Rh3saepDoNY9x2Lcbth gVj4JAStSavv4NyEyy312rHu8IZKCHj18w1gi1+23WBxzyrWhRcF68ZJqIcsaZpj1NVZ3j mVVykomjRRBs0C6RQAHQ8NQccL2dZu+f5ct/bOcycG1xw23YbZ/p4c+3a6sMKA== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1795457514; b=u5npXpvekBO3Wi9hsv5F73TM1HS53e6I5M+vBb+480gyVPy1Of9J+7EXXrH36MuDQH5aAR 7/nYVZKl3DWD48kksdCKcU47emNmONphiWwYbzvWifjBRzOjfLc0GJaFr8KCS4Hk/G46E9 45v99hmntITVmxfFDWDcLTearcsktlvWcfhhLd+SxvGFpj/akLiXIb5knqTUf0MG320wJL vD2y3gAK+cNL9aWMFpL6EmmiTA4hb8mUIEhB8WELTf2t0nibChiCHi7jgvZILdR3L1KmdQ Ih9VbNBVV7f+E8typ/Rd8ttejqvxSr9VESSsKwLBJ1PczDIoOCM+1wiLV/Loow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1795457514; 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=fHtlbxMa+0guUBY8Sw7nCz17ZjdtKNRMF11lQTbDlK4=; b=PgIy9fhKop/gBFsbM9+yjWcWmuFvWM/P15MuIwatWIbm5AenpB1bPBd/Ijdxq0aiVHuxgH 4ctnATqR1zWPuO6YFQZx/GLJvo+w8O6PtfpdsRjPROgZhjLlyuHSK/8S579NCjZCWNuiCs yqg9iHW/40f8FRPJjjuIemVD+oFAI2LngikcM9/pudvqxZEsoLdf1Tkz41DJo7WwaFCVM2 rPzOuR1UJLK44qP67ScnxgHR+Avjz2FnC+f7MMCd3U40MK4Shwk+y2f1wj+UOEXiKRQ4fU e0c03qmfN/uZc58gYEZqO+GKP5bmlKFgApiGjUQcRVZcpV89X/3BsmVK3CA9qA== 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 4jYDY62wbWz12h0 for ; Mon, 23 Nov 2026 18:11:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 6388 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 23 Nov 2026 18:11:54 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: c556863aad24 - main - pf: fully free rule on error 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: kp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: c556863aad24b793726b71995826e9f86c3178cd Auto-Submitted: auto-generated Date: Mon, 23 Nov 2026 18:11:54 +0000 Message-Id: <6b0481ea.6388.54ca7604@gitrepo.freebsd.org> The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=c556863aad24b793726b71995826e9f86c3178cd commit c556863aad24b793726b71995826e9f86c3178cd Author: Kristof Provost AuthorDate: 2026-11-20 14:25:50 +0000 Commit: Kristof Provost CommitDate: 2026-11-23 17:17:12 +0000 pf: fully free rule on error In pf_ioctl_addrule() we freed the rule with pf_krule_free() rather than pf_free_rule() so not everything (e.g. kif, table, dynaddr) got freed. As pf_free_rule() expects to be called with the rules lock held we only use it after we've actually locked. We continue to free the rule with pf_krule_free() if we error out prior to acquiring the lock. This is safe because we don't set up any of the things we need pf_krule_free() to clean up for us until after we take the lock. Reported by: Kevin Day Sponsored by: Rubicon Communications, LLC ("Netgate") --- sys/netpfil/pf/pf_ioctl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index f6baa248722c..9d45145f6f63 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -3213,6 +3213,8 @@ pf_ioctl_addrule(struct pf_krule *rule, uint32_t ticket, #undef ERROUT #undef ERROUT_UNLOCKED errout: + pf_free_rule(rule); + rule = NULL; PF_RULES_WUNLOCK(); PF_CONFIG_UNLOCK(); errout_unlocked: