From nobody Wed Feb 25 13:42:06 2026 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 4fLbNt4GZnz6Sq1l for ; Wed, 25 Feb 2026 13:42:06 +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 "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fLbNt3ZBRz4CsY for ; Wed, 25 Feb 2026 13:42:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1772026926; 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=6hgQdH5a5OLK6I9hm1nWixlWzI95zrWL00HZfBKZ53k=; b=grPiM0ttykkmWyLkHwzJtJtRBgPjGEZGPaQm116AEOrfqnuU2ekngwa0wEgVTh13TJpItF ewtokCbqFV9XuFaIn51LK2STw5LG1A4OeRDl80j9N/d+ijgpiQHFuWry9EyuwOsiulcLjT PID43BmAzsFTWzyHgspQyyrdb97ErxtDp0io+dOQJFIZQEdv70H252oEc7wNaoPfTkJc4H Y8VntPUlu+pFYBTCrMtS4cFxRKFJHNPwVa961B57sFHTJRn4hJlUKO1IxACg5ZwrH8sPm4 l5zIa7KjBL1258FzRQQzOQZDkAiF/rRbdblCfGXmCMQG3P37h+71QuzYdDy5UA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1772026926; a=rsa-sha256; cv=none; b=R5EGr55Jj+JUbi2C7qALd0ZrNS17RT2JNfWTOOkiFR4K3xTWiyOFfUm4qFi8gJNuUjtK9Y VfPIFX/y8xr7smiBoq/Hgy0OK+FmuYlAcoQSYK3frf89t8o12M1tm7dXH3vjPZPfcsB3wu uta0yNgkolzkJ4IyI7yvgsa35PWmVAl1miVoDg4rUSOBQu+UHbBnjaYP8bcWEy4Qqa+NTV L/Zpab5qJG9+VwnGH4qxEV0JxFb4WUIzkrPCwewspQowqpKNMTNkDf7/QJYIj7yHJYlHUb rtVPRB6xGx75iHMEeTIBHp6m66xA6iP/QGEG3HL1Ska69khRJG8TWoxGOtEw1g== 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=1772026926; 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=6hgQdH5a5OLK6I9hm1nWixlWzI95zrWL00HZfBKZ53k=; b=bPq1U3IDwDtKOnFhvPukFDv1OxIdkY9vUaU9UreCPd3hzm8U7SpGV5ZPLX4d+vcAQGZrou BYQhmMnLkFu9txXtVC1VQvcXFj95Y16NJzmsl6NPl+iimqfYBkbx8i6W+S8ekOdAaSpN2m XcFyMEJpgjmk5qYiX+uyJEQluleiGtVJjF9FypANo5FL78nv1CmI82dVtxIlwLEUp5naNf gcXWxOXuA3UR70vGouQmoMEUGdXtNZ3qsMTJEM3ZhjOCAHTPmURcv/RjW/G1wF2pUXB6sl 5gXEOVVut5h4x8zsCD78pq+p4+NtTwD2FZmmi1R4EW7SBxv6b8rf/XZ5e/rheA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fLbNt36Phz136C for ; Wed, 25 Feb 2026 13:42:06 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 470b8 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Wed, 25 Feb 2026 13:42:06 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: b642867c2cc7 - stable/15 - pf: avoid NULL deref on purged states 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: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org 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/stable/15 X-Git-Reftype: branch X-Git-Commit: b642867c2cc7e06057ba766c9847ecd200c53bd2 Auto-Submitted: auto-generated Date: Wed, 25 Feb 2026 13:42:06 +0000 Message-Id: <699efc2e.470b8.732e3c13@gitrepo.freebsd.org> The branch stable/15 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=b642867c2cc7e06057ba766c9847ecd200c53bd2 commit b642867c2cc7e06057ba766c9847ecd200c53bd2 Author: Kristof Provost AuthorDate: 2026-02-18 18:23:42 +0000 Commit: Kristof Provost CommitDate: 2026-02-25 09:13:13 +0000 pf: avoid NULL deref on purged states States can be invalidated and still be present in the state table for a while (until the pf_purge thread cleans them up). These states might not have keys set, so we must make sure a state is not purged before we try to access those keys. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit d60082f16e4c91d4b97d8b3b56b39fa348ecfbda) --- sys/netpfil/pf/pf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 882c7f4cc0dc..8b0fca69827e 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -1943,8 +1943,10 @@ pf_find_state(struct pf_pdesc *pd, const struct pf_state_key_cmp *key, /* Look through the other list, in case of AF-TO */ idx = idx == PF_SK_WIRE ? PF_SK_STACK : PF_SK_WIRE; TAILQ_FOREACH(s, &sk->states[idx], key_list[idx]) { - if (s->key[PF_SK_WIRE]->af == s->key[PF_SK_STACK]->af) + if (s->timeout < PFTM_MAX && + s->key[PF_SK_WIRE]->af == s->key[PF_SK_STACK]->af) continue; + if (s->kif == V_pfi_all || s->kif == pd->kif || s->orig_kif == pd->kif) { PF_STATE_LOCK(s);