From nobody Wed Jul 17 21:55:27 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 4WPV9X1bDSz5QT5w; Wed, 17 Jul 2024 21:55:28 +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 4WPV9X0cbKz4pSn; Wed, 17 Jul 2024 21:55:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1721253328; 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=K+IjChQ9s3JCd9oAHyJZYkrGbKeqzvGEpJUTafOw5qQ=; b=F1w8bt/3DftL5RyoX5OV182fcRJue5aH9idDF+ixSzU+C/v6aO9PmoblQutb4UurlysUC4 BNHU0KyOG2LL8AjayVi86lAYB5TdHquwAfJDmhz3k8vvXmNqxd8Tjk7GSvhxq9r9mVSX4+ fykBtybepbNYL1YTCPz1O7Fk4tisuLUK+d2pQU2YYMq2z3sJA5q+OD5hQeM069zM2xrKbW cArhK/a2FafNisAmwgcndE4rUeWjGpKhQlD2heYERLWeQgL6edWY88nsGOieGA8u/1TCqA mGBWLuZdviJDkzIs5I9hH5H9fXcnl8gDeg3eYzs2elud0JdYflcga60wMxkEhQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1721253328; a=rsa-sha256; cv=none; b=L4/EUKZaZGAnY3QKhRmIzTGHnycUYxnUDodoEvXgcUmgYgaWyiUKSCAIfYM+WjROS8mgJy V/GOeKetQx2MYUcvlnjL1D2YTokm4B9t4tYFrnskefxih2zmOf1wO+p7bJsTliQB/rulPv viHIW8HLDWkKz9y4MmzHsDBICbHhAaIUFx/gfxXnsZRrxw4JTSdAbQAFf7yOTrDN6DkXl3 AuucwYjgqN9Bl989ubHvg6Cu0InvvRXPTL0h177osjgTp4h4Ae7MPZuUgt6ThQ2HX+AdX9 3r51iSZwCYRs+h0hRtmQzsiWfwaPxNjDpx2dhGNVCKkpShA4ppAJrMCTwqKmJQ== 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=1721253328; 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=K+IjChQ9s3JCd9oAHyJZYkrGbKeqzvGEpJUTafOw5qQ=; b=AcTkm2L6UeIb4sooGDFPx7CRxh1PhRuoR/kIJon2aF1nWdwvje6Z18qLOd1796DvJMKesP FzQNLv7uvRvXfkh9XBH5zDxVjxhzhopA2qyLnzvmq7iJDUllbeKj2H3oTmkcEe1Eis0B/N Tk4NJqsdHlei+6FNsJOkk8Qi01NfaeaoOrLqU47JN13Cb9ObLKdChw8ouASfwOd3WZaGRQ k1t0a8046PpZcL1zFlgxK03EHrR+c3gJEl/WNYjupzG60N9rstkydvVHGVLI3l9xRnniuW bCkZqfCEdx5FNV9alVu2AzFwGrTDwQSq1CRmje6kp+HoSDFa6dk7DC4IKfvXpw== 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 4WPV9X0D3wzLsM; Wed, 17 Jul 2024 21:55:28 +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 46HLtRT2096871; Wed, 17 Jul 2024 21:55:27 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46HLtRul096868; Wed, 17 Jul 2024 21:55:27 GMT (envelope-from git) Date: Wed, 17 Jul 2024 21:55:27 GMT Message-Id: <202407172155.46HLtRul096868@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: 1981d52a6e29 - stable/14 - 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/stable/14 X-Git-Reftype: branch X-Git-Commit: 1981d52a6e295f4b01a2cb95007806605d5e86ee Auto-Submitted: auto-generated The branch stable/14 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=1981d52a6e295f4b01a2cb95007806605d5e86ee commit 1981d52a6e295f4b01a2cb95007806605d5e86ee Author: Kristof Provost AuthorDate: 2024-07-09 18:49:49 +0000 Commit: Kristof Provost CommitDate: 2024-07-17 15:23:48 +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 (cherry picked from commit a9639adaedb4d67340c4ae386fe8fcd18e4a8a21) --- 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 6671839fc5ab..4eed6dd31860 100644 --- a/sys/netpfil/pf/pf.c +++ b/sys/netpfil/pf/pf.c @@ -8164,7 +8164,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); } @@ -8769,7 +8769,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); }