From nobody Wed Jul 10 09:55:21 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 4WJtWs3Wz4z5QcGP; Wed, 10 Jul 2024 09:55:21 +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 4WJtWs2zVrz41f0; Wed, 10 Jul 2024 09:55:21 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1720605321; 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=KlDsnOdkgsS+KUXT1MXnPCZLHuj2HPxYVigOxMF3/z4=; b=Dg5m3AenBtdNeVfBB7jy0aV3IMn85cS4DpWNit+kxdNt2vRzu71OLKFa3sdBnTw8xVyZKj SE3vM4CBr7jH5VgxHVe06IJBKWBEJS17iRBHEm8dJe+ZcWdbzCfVyfJ2057d4g96yIFAsE dw8/N5Vhc0G6XiAkX9R3AT7Mpo9uljsnRUBYSgSdnumBdZDYMTASM5Tu18R216Kpdh5ss4 QS03KlpPjTWLrAUWYS58midUupWYvWbexSftuLpVwg9R4lRFh5LWdh8QTHL6H19HOBV76H Z5wlbn4Z8cKzUi8pWjA8zNFzFRK8QLeVBwUuXP1ayFqbrlhw8PjknRnuardO4w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1720605321; a=rsa-sha256; cv=none; b=qFafx2Uwp1VK81VJlnPfR1YWkF9SQayJe9JkUiS5hCTRfOoFSOicmBRk3ipDMlOo4t3OTq 2I+5gzFMLozxuaa/vQSVtKRXMvk3aVud8rb2NF8/t2N9aFrNm59m6Dp+r46rHnSrgaFJU2 yl3RqYTkIgxtAM0fXMWSc/NKeZbc7mro8g/X9XSIZ28FSQ27epMevo1rFlURX+xceLHtfp CnJ6m2PZy601xWpMOtNFpqSEkLPPZhGuC65q7Lanyy2fnTmhWic/p9lGFyjS5VpglYREpF cICPzFIXrLO1aBDN1T6LbtaHkoPgF8z9SoPKxBG5JkNqiDpjVygqS4IzPm8W+g== 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=1720605321; 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=KlDsnOdkgsS+KUXT1MXnPCZLHuj2HPxYVigOxMF3/z4=; b=jqnPuQtGpEr1MKpCnMAU7znoXOPvnHVjtkFOuRR2rmJn1O/vNcpH8rKgBimkP+F/9+BIo+ rimwgHXrI2RTTtholmrsAR3Lh12rfrqhAC/D/zk8xIBGWjOll4DMN/oJL/OUri5XF/99GW GXtjI23uOBGkMn1bwnZlME2q+6m+bK1ck3dBexNfJouXkLkJe9Mo2IgHSRLRUiUTb9ZqHW M9J8IqAbgjxguntdZaP+9rsfq9JK8T5ugpLMn1KjinP4ISVcNYPLBY5aQ1XqTe1FzUjnf/ BkNr9+ywt1O2Tzm5Lb3XsBZreBBWsTRMBtVmoMmobjLLyhZE4CR6K3UjEHbKEw== 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 4WJtWs2bRrz1CCs; Wed, 10 Jul 2024 09:55:21 +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 46A9tLoa036347; Wed, 10 Jul 2024 09:55:21 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46A9tLYA036344; Wed, 10 Jul 2024 09:55:21 GMT (envelope-from git) Date: Wed, 10 Jul 2024 09:55:21 GMT Message-Id: <202407100955.46A9tLYA036344@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: b1e0f0ff9d35 - main - pf: fix state locking issue when dumping by id 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: b1e0f0ff9d35913f6c1dbedcf3a7f5d63eed682c Auto-Submitted: auto-generated The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=b1e0f0ff9d35913f6c1dbedcf3a7f5d63eed682c commit b1e0f0ff9d35913f6c1dbedcf3a7f5d63eed682c Author: Kristof Provost AuthorDate: 2024-07-09 18:41:52 +0000 Commit: Kristof Provost CommitDate: 2024-07-10 09:55:06 +0000 pf: fix state locking issue when dumping by id We forgot to unlock the state after dumping it. Do so now. Sponsored by: Orange Business Services --- sys/netpfil/pf/pf_nl.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sys/netpfil/pf/pf_nl.c b/sys/netpfil/pf/pf_nl.c index 615a9229b3f3..401baddde948 100644 --- a/sys/netpfil/pf/pf_nl.c +++ b/sys/netpfil/pf/pf_nl.c @@ -148,6 +148,8 @@ dump_state(struct nlpcb *nlp, const struct nlmsghdr *hdr, struct pf_kstate *s, int af; struct pf_state_key *key; + PF_STATE_LOCK_ASSERT(s); + if (!nlmsg_reply(nw, hdr, sizeof(struct genlmsghdr))) goto enomem; @@ -282,10 +284,16 @@ static int handle_getstate(struct nlpcb *nlp, struct nl_parsed_state *attrs, struct nlmsghdr *hdr, struct nl_pstate *npt) { - struct pf_kstate *s = pf_find_state_byid(attrs->id, attrs->creatorid); + struct pf_kstate *s; + int ret; + + s = pf_find_state_byid(attrs->id, attrs->creatorid); if (s == NULL) return (ENOENT); - return (dump_state(nlp, hdr, s, npt)); + ret = dump_state(nlp, hdr, s, npt); + PF_STATE_UNLOCK(s); + + return (ret); } static int