From nobody Sat Jan 28 01:39:20 2023 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 4P3cYh6mmWz3bpyP; Sat, 28 Jan 2023 01:39:20 +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 4P3cYh64N5z3n6Z; Sat, 28 Jan 2023 01:39:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674869960; 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=+6CxO+a0ufnjLmFdScqNS+TR1Gq9l5LyidgpJW7qCqQ=; b=lhVgfBfoz4kNjSErAwngV6YjLlZnYho4J8nvrKRnsRsPm8s2Sr8aZjtBHzt8L5vncFq0UH HJ9YZjF8S0WtK9CZTbjHDzyzXo5FEJwqHcqPjFsdY+4e8lQ8D9ZC/Mrnbn8CIswhw9MSVV fa73/CJdHDTonF52tL8uYrApCA5fuYqt2NvVqPXnAtOKvpR6qvL3/jVIxezp6VYyG7GmJ7 6iPARIl9UYB+SPo+5fNrWLKhXke4fvRXuHGZGjiNfDgCzblR1Kn18swJ4qOpwYRvQLsEAK OmJ9MXNJb8V5x0DbaxRebFcodXVLEbd8lNGiVswJdvvlFU1Md9SBHJ11gGrCzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674869960; 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=+6CxO+a0ufnjLmFdScqNS+TR1Gq9l5LyidgpJW7qCqQ=; b=fKviMWoKPD5NXhc1HkPD6fQMjRIsNrz90R2BMZHPP4nNLuMC2Yzq2nx4otMGdw+vo3lSCr S1M5a7WVDNe5PGEvs1LlTlhzI01mxG4UZtL73Wvf1yBQLVSV+4E3My+Jzb9o+LP/cSOXmI 10WpYCm4xsyO33OtcQUD2OVwYs6MQtAYgeLtTS4igMWLf24NaTcqGnwr95ePn7aLANKF6F 8E3eBDQ7hi4TDeKHAm1grLJ012hkT325s2ets6AgXm2Yuct8ojZ3amiyNqYuc7Ttr88xjk jkFa3DYL503jjZHYlryN3bjG9OyZXNRfBsKi/omWJzMX0BsishC65CQqFJYn/Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674869960; a=rsa-sha256; cv=none; b=H1FSdxUiv61ylYUIM2IK8zZjnl78ukepH1L1lkqiBHlvQp5eqj9UfDYB/LY3DHz7uDguzU G6REsY5gCZy+IsIyyeaoHADYokAUBXo84+a1fRaj52TfKR+OaXuPe/IEocpFKjAoVF/XKE 2Cl4NnP9g7chjFU7kQfgepzoA25a74BWd2t8dx80nXONJEaBQb8NhG7pXIFbBF5RZ+Ap8m LBwyb3ZatfOkcSH7ITu/sX8mPYgFTJSPABbcyQJQZ1y1FYMhXaMLQqCHEKj6VWPoqQ9Tng w+YTpauchVcF/VLUE1v3SWX/KWJlvdNOT8rNQoWZNARitZxuMQl//QhHYnohxw== 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 4P3cYh4d2LzWYf; Sat, 28 Jan 2023 01:39:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 30S1dKnT056003; Sat, 28 Jan 2023 01:39:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30S1dK1X056002; Sat, 28 Jan 2023 01:39:20 GMT (envelope-from git) Date: Sat, 28 Jan 2023 01:39:20 GMT Message-Id: <202301280139.30S1dK1X056002@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: 76e1ec4e10fa - stable/12 - pf: fix panic on deferred packets 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: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 76e1ec4e10fa9a85bb8090cdf61e54c7a19508ee Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=76e1ec4e10fa9a85bb8090cdf61e54c7a19508ee commit 76e1ec4e10fa9a85bb8090cdf61e54c7a19508ee Author: Kristof Provost AuthorDate: 2023-01-13 03:34:20 +0000 Commit: Kristof Provost CommitDate: 2023-01-27 03:16:43 +0000 pf: fix panic on deferred packets The pfsync_defer_tmo() callout needs to set the correct vnet before it can transmit packets. It used the rcvif in the mbuf to get this vnet, but that doesn't work for locally originated traffic. In that case the rcvif pointer is NULL, and the dereference leads to a panic. Instead use the sc_sync_if, which is always set (if pfsync is enabled, at least). PR: 268246 MFC after: 2 weeks (cherry picked from commit fd02192c3acaefeb62db11e0c10ab36240b79ba2) --- sys/netpfil/pf/if_pfsync.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c index 88e0831e82de..eeaed225bdb1 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -1823,7 +1823,10 @@ pfsync_defer_tmo(void *arg) PFSYNC_BUCKET_LOCK_ASSERT(b); - CURVNET_SET(m->m_pkthdr.rcvif->if_vnet); + if (sc->sc_sync_if == NULL) + return; + + CURVNET_SET(sc->sc_sync_if->if_vnet); TAILQ_REMOVE(&b->b_deferrals, pd, pd_entry); b->b_deferred--;