From nobody Sat Jan 28 01:39:19 2023 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 4P3cYg5MbQz3bq48; Sat, 28 Jan 2023 01:39:19 +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 4P3cYg4wFnz3nKn; Sat, 28 Jan 2023 01:39:19 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674869959; 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=0UrqQwi+2yUdR47oueNL2fVZc2qYCo66WFcTHXypyR8=; b=efei18LUR9VyAuTvYYLEX3I0ha9fTs2zQeTih6BNDwiuwXjj/ew1LMN5AWXi2L8lak0UXx Z/ceCLI+MXMgavCRGdupTRG4JMrn2BGbYPfdnnuJl8TzhlyNFnmKBdlDnFOlvU32v8DB/L LmFhrdVxP8Ed/6W04VI72/XBXvaUQzTc6oFKK9/JU5Fd7RGBpvCPOLcAZMfCtMFE89wbFv qqVWhsFUjGK6t3QKxdPjXyM7mcMwZTTUAJ7S9fcTV8w5llZJGMuapI9M4DvQ3pLW8WWZ8Z r5SKifdr1+l0iGrRlx3/3yDsZaGTeL2liXFym1ySiE1S9RnYUy1yyrzx9CL4Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674869959; 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=0UrqQwi+2yUdR47oueNL2fVZc2qYCo66WFcTHXypyR8=; b=P0AwzKgD+YZV/nwFTUNYyHBznpeGJgSDl7BmkgYm4LxG38koJK3hoSFsRyQAg1NXoMc/KJ ZBfJzNzJw0fBQY/k1Dvgaid+0PiS5LxPrxqu63g4jmafCz2NeptpRa/6xjR7F4Pk40MLET eb+srHiARBJ+54nSRg4P6OcVtG9ow95U3Qdr8IUM7xaW+sZCdR8X86EyU9mXjLVYBMvOnJ 4iDT5iBZftUUdT6/oAwFqePV8emDUkS+TTNb4h7XyTSo39a8htXwWd9MalFZXvwrqdnP5Z B2cCkkcOjuweyHt5HnUu1o5nitp8FCLPwY/wswIPpjfqcEfL8jc6o3N10Dv9aQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674869959; a=rsa-sha256; cv=none; b=gx2z9svBjQ0+CLhMqhK6sd0O/ClUzgWrhaUkl8ru2IgBoh2VyuDOMMXRh6526amel8CtZ8 9EJw9817V/2tL1rhq0Uh6dJAgIkUhdnQ2D1r/L5N+VzgghB7IvmJPtNQh/pGt2cZa+v0hI 5Fm9maVfzTapsgVKO7N8F48lWpK1BkWdqHg9cVHeJ3iQyFxN3ej8FV0ea7nrsye4yvB+A7 l38zxhS3LoScLjgTkR8RWQrgZ7F8Btwv5r3RwVKSRz4LjOi7Vv9bdP0f6Tpl3qlWZtqzyz Ec0GDplsahdoLFVCFcR+OMd4GcTFxXfhZDTk3f5bwQqffqUfw6dhhz3iHmD0dw== 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 4P3cYg3kdVzWhV; Sat, 28 Jan 2023 01:39:19 +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 30S1dJqM055891; Sat, 28 Jan 2023 01:39:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30S1dJtr055890; Sat, 28 Jan 2023 01:39:19 GMT (envelope-from git) Date: Sat, 28 Jan 2023 01:39:19 GMT Message-Id: <202301280139.30S1dJtr055890@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: 8edf0b52c407 - stable/13 - pf: fix panic on deferred packets List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/13 X-Git-Reftype: branch X-Git-Commit: 8edf0b52c40762d64b3d4318235b58ae5d4eff58 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=8edf0b52c40762d64b3d4318235b58ae5d4eff58 commit 8edf0b52c40762d64b3d4318235b58ae5d4eff58 Author: Kristof Provost AuthorDate: 2023-01-13 03:34:20 +0000 Commit: Kristof Provost CommitDate: 2023-01-28 01:34:38 +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 33e06eb4c79f..47c3217f399c 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -1822,8 +1822,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--;