From nobody Wed Jul 10 09:40:05 2024 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 4WJtBF4fj1z5QZjL; Wed, 10 Jul 2024 09:40:05 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WJtBF43JBz3yfN; Wed, 10 Jul 2024 09:40:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720604405; 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=0zSdWCziVnkERzwmwkqTdRnf4NqYrnTnpn0hJ0ZCT/M=; b=SfzNoFK1vKJJM5vupefUSubsU/qAGNFNWaZicCloyP5mtypWVRE3LHHbzYI/3ItqjC8QGF LfpTJJUeeLeafZm2IHweVwMZZRErOG0pMUgwVbrAsuGbqSarXy8DX2dl/EnONKHPvw4WI3 efJv5WCd0nItvRfwhE1xMaQ3eL68WNYWXx6v/XIAUQNTMR3aPmMoxrcTsHXmuPdYbB29A5 anl8gDC2NOSR/+p8S7YwvpLugDBbg6TcBxQpSoAJusV00srQaVJ53rkk2xy9nN7x76xilz 2uKKAGHyZXbt1Pfty8lF9Mtg30UU2Bs12WVbr4M2rB2O7D79pQGSqOVg7/9NqA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720604405; a=rsa-sha256; cv=none; b=MX617+oymsP4oseEUA6jtUB8MGTfwyZ32TiuEWDbl3O/EIYzar3Y97SinQbsC/f0UQrFce ff1wi0SqZEDw/eWdqfk2XJ3ekkItGEQdIoBgaZYSXUSUYUqEHO0eHFCD76d6gIrF4bqv2z 5N6QWkokge2Iy/Gzj6phX08QQuRc9xI4npc+9kR7Hk7oip6ByrirDOtC+VuiDFbGHdENqM 6dXf1o26KqEe+BuZCvhFHSuL+zxmBJSAR1MLNPxOEAPezKKlsjJv0KUWrxBb1nFbDNVcsI NH/cunfbg3/noY9eaGaLldk8z/xtG0Uu49y+XR747LBdurksOIhXZs5OTk83bA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720604405; 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=0zSdWCziVnkERzwmwkqTdRnf4NqYrnTnpn0hJ0ZCT/M=; b=F10t9/lPkgM5+wlsPsm5Y5MiT7ufkKExMxM9Pxye8LehFGVLY6AfqCNoNG0t3tig1Djuxb K6TKZ9cDxoyk8n8RWzE5UAdo3SH3CBuQvJ5hmXzM50Hp+QPq+l/UtqbOnb/SxyZdHnViZf dkU76JdOg6muEkXwmh2qB0ZULGnGSEUISVO5mjNAHeVg1IHCtMqOaT7sCGSYVkkje/IZj6 ZGI90sihhPg/+1bcUzs3E0f80bO6h+uzR76KHxohV79HCXfLlkMmmiwNA088lH7zCuTHvc RXogdnyY1LYvZ2nzWsL7L0iRUv9ba4EdhUR/wyJSf/qSa1+Hd8A0rq0LOi+gew== 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 4WJtBF3XjKz1BWK; Wed, 10 Jul 2024 09:40:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 46A9e5ZE005552; Wed, 10 Jul 2024 09:40:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46A9e5fI005546; Wed, 10 Jul 2024 09:40:05 GMT (envelope-from git) Date: Wed, 10 Jul 2024 09:40:05 GMT Message-Id: <202407100940.46A9e5fI005546@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: a9639adaedb4 - main - pf: fix sctp deadlock 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-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: a9639adaedb4d67340c4ae386fe8fcd18e4a8a21 Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=a9639adaedb4d67340c4ae386fe8fcd18e4a8a21 commit a9639adaedb4d67340c4ae386fe8fcd18e4a8a21 Author: Kristof Provost AuthorDate: 2024-07-09 18:49:49 +0000 Commit: Kristof Provost CommitDate: 2024-07-10 09:39:34 +0000 pf: fix sctp deadlock It is possible for pf_test_state_sctp() to find a state and still return PF_DROP (or not PF_PASS, to be exact). In that case we would run pf_test_rule() unconditionally, but this would overwrite the (locked!) state pointer pf_test_state_sctp() gave us. As a result we will later deadlock, trying the lock the already locked state. Do what we do for UDP and TCP, and explicitly check s for NULL before we run pf_test_rule(). MFC after: 1 week Sponsored by: Orange Business Services --- sys/netpfil/pf/pf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c index 21647bd733f8..764d2fa54179 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -8269,7 +8269,7 @@ pf_test(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, V_pfsync_update_state_ptr(s); r = s->rule.ptr; a = s->anchor.ptr; - } else { + } else if (s == NULL) { action = pf_test_rule(&r, &s, kif, m, off, &pd, &a, &ruleset, inp); } @@ -8895,7 +8895,7 @@ pf_test6(int dir, int pflags, struct ifnet *ifp, struct mbuf **m0, struct inpcb V_pfsync_update_state_ptr(s); r = s->rule.ptr; a = s->anchor.ptr; - } else { + } else if (s == NULL) { action = pf_test_rule(&r, &s, kif, m, off, &pd, &a, &ruleset, inp); }