From nobody Fri Jan 13 20:42:21 2023 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 4NttdV04dmz2p98n; Fri, 13 Jan 2023 20:42:22 +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 4NttdT6RR8z3rPy; Fri, 13 Jan 2023 20:42:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1673642541; 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=QYWPkOrE3ioILhJs+6n7Hej8QtsqvA5E3fna46uZwK4=; b=g5GmOu99HDayf5ivlHo/QITfva4+a/ka1J9bMboqFssrs+nSeaKnWnjOtF2zAg2uMqePa5 pK85La5IBLNcxvtVuelI6bjvNimH7lPbCkNhrlLID3XesdzF5t0RReyUOsyBKRZv1FpKRF SXbebmn84eRKIXM9Y/gfaaDJZ923+3Sd5XP9KOHVk+a8P3HUAZJnIpRew1IzZ37upmuGUY RBV/O3N196Os2hse2kS6k9c/mkn6C9fEzh3rzvQG5jpuZKnTFeJs6mL+tjVCwD0hvzw04V et7FhHc0AfvaSM+g0Ff0VDJQHinBc1ojmecqVGsMvfmjcf41pKt5WzJuk8zWfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1673642541; 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=QYWPkOrE3ioILhJs+6n7Hej8QtsqvA5E3fna46uZwK4=; b=FJMyS+DOl2KeusUfdoCWVgz+bamJNYPo1Dmlw1RHJpOJP9U5RQ3BRm+hE/B15QfMSkVZn3 FQTKMncwoxrALZ1/lwau1MiQOdfy95+9Rv11RPeGhmSPwjv0K0B7HLshad/iljdFLc/Jdp zy4kxRAncpswr0AJbALXpQ11soq5X9oRFcopozk7Bm7MctqhIHXPUHff5ipeEQQvnJEKaK lCHk8qySBkRIZySwp5D4sz6jQPDc3nqQ7uf3MD7oVtXsVmqzmUOnOyMKa27L/Iol5xThdu Ek56cnI4YVCiggBpZjXh02F4WjKr1CBJkNgWET+bCAHSq/zwQEVMUVduT8bEsQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1673642541; a=rsa-sha256; cv=none; b=j3IBJ2VetNYuI3irNCqOfHOhklf9F6LJ5+CzGFaggU7V/cwitwAL4bdJJyTVOP+mDnd9Oj l6+gfN1a9ojPBMPDcMplXsnSlDKthygkm9eDsxpC7WGvV7qs/bw7ECt5dPvwfop3XCtBEh Ik75Y3cPHPn7eRM2mGrvvPbu91hxTsDlo8PYXU35dYjLL2DP7AvV1+grJeE8GCNe8oCu9s hvMsXH3A7eDX1sPqKMvxvxapwa9LHsxDIPzaA/PDjMjqeoZndWV+NjtNwB9cGLlvNVRGca OiPfrwcp3fHqi+ACqKEJSJlqesQc85Y9AaDX7+qBg2kU8690RMKaLPVe5SignQ== 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 4NttdT5VVXzMKL; Fri, 13 Jan 2023 20:42:21 +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 30DKgL3Q082225; Fri, 13 Jan 2023 20:42:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30DKgL25082224; Fri, 13 Jan 2023 20:42:21 GMT (envelope-from git) Date: Fri, 13 Jan 2023 20:42:21 GMT Message-Id: <202301132042.30DKgL25082224@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kristof Provost Subject: git: fd02192c3aca - main - pf: fix panic on deferred packets 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: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: fd02192c3acaefeb62db11e0c10ab36240b79ba2 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=fd02192c3acaefeb62db11e0c10ab36240b79ba2 commit fd02192c3acaefeb62db11e0c10ab36240b79ba2 Author: Kristof Provost AuthorDate: 2023-01-13 03:34:20 +0000 Commit: Kristof Provost CommitDate: 2023-01-13 19:41:25 +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 --- 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 a2baf477873e..61308a35a7e1 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -1819,8 +1819,11 @@ pfsync_defer_tmo(void *arg) PFSYNC_BUCKET_LOCK_ASSERT(b); + if (sc->sc_sync_if == NULL) + return; + NET_EPOCH_ENTER(et); - CURVNET_SET(m->m_pkthdr.rcvif->if_vnet); + CURVNET_SET(sc->sc_sync_if->if_vnet); TAILQ_REMOVE(&b->b_deferrals, pd, pd_entry); b->b_deferred--;