From nobody Mon Dec 06 12:25:44 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 2666118CA612; Mon, 6 Dec 2021 12:25:45 +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 4J72hS69Tqz3GYZ; Mon, 6 Dec 2021 12:25:44 +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 B54033867; Mon, 6 Dec 2021 12:25:44 +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 1B6CPiSh048110; Mon, 6 Dec 2021 12:25:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1B6CPil0048109; Mon, 6 Dec 2021 12:25:44 GMT (envelope-from git) Date: Mon, 6 Dec 2021 12:25:44 GMT Message-Id: <202112061225.1B6CPil0048109@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: 27bd812c5c92 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 27bd812c5c92af9e7acdbf100bd98166a717bb76 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1638793544; 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=nXdUJur+gct7DK6Yg5XA3KFuSbJ211tIztJRbdo4bFk=; b=RnFdjVMFDd0l41Cu3mHSLLZeKCk2aeo7hzABUl4BYDsZVZ6d7pThzAhgr7AjZCNl5gY9cQ TL5TNkkn/pq+sTxffVKnHegJO4JFNTh2V3zB83twDzNUbD9rB/tTD8DT94/iA9GJZAU4Q4 XfXePpVx+531dunouQy6pEgw+vvwLm9uba9y+9nU1/xnK4QgRJOg4kj7vCMOOv2+hzFt8P Za14uLCrTEV7hoL3aNaLHqJlPhbIPAoCGMJA1V+dxEHtofVydRTU8v2yE6NzQ0jRh3qlOo rJsxAAA7rmjdatCH0Pt+eY9BRhMhCO76/lWapSxLuHUtnPgiH0IJvhkfN8F1AQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1638793544; a=rsa-sha256; cv=none; b=EDga9POAZooPGvM7xX4WEryeUb2VrLnarPpnB+qQWTUa8EgmE1PuhBFOzhoQIaHLDNr6L0 xwgkgbOQU8M4YHOyZInCIF4WDNEg5Kr6iP2JBrhxzsyWm50Yd5R6KN74gBfIpwoX1mLTGx hKUK7LoKM3oE2pkzySHEFEGtGI9jKT/T/o4Ax9RdTRKLRjKIzcc/A5OFMgm2jcUwENVcvj JOJfF3A+ffgbKkUDBemrsEddtCKpIlgDZPSUGnwwJmOHSvmKguixL1txagMe9kb6ebmNdo 4snywJQ7djBsP1QSfkLL6rYjLi7qkQUmyAD5UfAg49qPwJw6vymfYcojRAwdBA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=27bd812c5c92af9e7acdbf100bd98166a717bb76 commit 27bd812c5c92af9e7acdbf100bd98166a717bb76 Author: Kristof Provost AuthorDate: 2021-12-02 13:32:21 +0000 Commit: Kristof Provost CommitDate: 2021-12-06 12:25:13 +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 --- 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 1aa5e6c0b066..166ac428fd9b 100644 --- a/sys/netpfil/pf/if_pfsync.c +++ b/sys/netpfil/pf/if_pfsync.c @@ -1739,9 +1739,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);