From nobody Mon Dec 13 13:50:35 2021 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 981E818D18AA; Mon, 13 Dec 2021 13:50:35 +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 4JCNF72Q7mz3ChZ; Mon, 13 Dec 2021 13:50:35 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 33D2215AAD; Mon, 13 Dec 2021 13:50:35 +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 1BDDoZKQ036038; Mon, 13 Dec 2021 13:50:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BDDoZRJ036034; Mon, 13 Dec 2021 13:50:35 GMT (envelope-from git) Date: Mon, 13 Dec 2021 13:50:35 GMT Message-Id: <202112131350.1BDDoZRJ036034@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: bbbe18b31795 - stable/12 - pfsync: NULL check sc before using it 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/12 X-Git-Reftype: branch X-Git-Commit: bbbe18b317956f3e0d87a277acc1941222fa8eb9 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1639403435; 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=MouV9z/oDpApvU8dllWqKM77GQTFk/vzKa0GbfXEx0U=; b=HEQXqkSTCh0rMIRyHRrEE3MWJzRgNxiMnLSnluemmvn8bYwXXyOAXg4lEGR1XzKkCbb0/z 4KS4jjRX4LA0XGUffJWeR19UiDSypTxqoKqjL3e8sq9XhFcR/lLiJ9V3fYtOt5nmnbQqxm tCRak84fF76fqQvNdjq9BLlv36xMkYChlgjnHg6UJpnNiPJe9jvPvfZj/unZkqgbhSuxyC H756ha48p7BBcUY6ERPnbm2vEctBTOi19FCWRlx2mMrAKw01u2BFOxbRHLXTuOJ/nbWeJY M/Pn/93FWTpOEcOzdVLv4JWjECPsDab9QTERzIaHS6508C4q4VXi+MgVuBE+uw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1639403435; a=rsa-sha256; cv=none; b=p90Itz4LHWzCq+AW28otVTwIt/dHWUcw6TwjAyR9nRC+lgtdW27OrPTFRdkcHjtTyYYIqC RAQel0Zh3m1VDXSzMORCSnXygBkUOqzBSDlObiMnRWT84GyUWByIUXVmzxE2r2StaKCykn dV9Eq5cPyZTBYVucI+U4RTvkm8ehl9b6lXOKIwUxCLaFQCt6fI54OIqTNVGrrGgs5POjqp Ks9/SONUA1XS6vl7QvAf2V2g3GAcEvaQZUO4izXm9kpu4l1pOC2KW/rFePAVhuZIvhZF9x jSWZu/w97bFiSlL46i1ZUB2sEwKjZ6NrvX0zWmGCjSAAeMpBAlWnmYnv4gnezQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=bbbe18b317956f3e0d87a277acc1941222fa8eb9 commit bbbe18b317956f3e0d87a277acc1941222fa8eb9 Author: Kristof Provost AuthorDate: 2021-12-02 13:32:21 +0000 Commit: Kristof Provost CommitDate: 2021-12-13 08:54:15 +0000 pfsync: NULL check sc before using it In pfsync_defer() we must wait to lock sc until we've ensured it's not NULL. MFC after: 1 week Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D33240 (cherry picked from commit 27bd812c5c92af9e7acdbf100bd98166a717bb76) --- 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 8feaea615867..d6016766ddcc 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -1741,9 +1741,12 @@ pfsync_defer(struct pf_kstate *st, struct mbuf *m) if (m->m_flags & (M_BCAST|M_MCAST)) return (0); + if (sc == NULL) + return (0); + PFSYNC_LOCK(sc); - if (sc == NULL || !(sc->sc_ifp->if_flags & IFF_DRV_RUNNING) || + if (!(sc->sc_ifp->if_flags & IFF_DRV_RUNNING) || !(sc->sc_flags & PFSYNCF_DEFER)) { PFSYNC_UNLOCK(sc); return (0);