From nobody Fri Feb 4 14:23:22 2022 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 E544219A81C3; Fri, 4 Feb 2022 14:23:23 +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 4JqySW18bvz4SKg; Fri, 4 Feb 2022 14:23:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643984603; 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=A81+l9K3MIm73G2IwGsE1PiDnwFX+9qQHPoCXbNBYA0=; b=X/1n28ihHA+PU7/o+l/liayPXPijzLceXztJCp9skYWPbS+lZfFvVwZZzX6A69ObZZ2sTY GRcOiZ39UDjBKiMvcvkx+LxhC9PDvdJaOmnEyH/IL9NjJfJRZWdTSkkxUVUzfnbn0aLAdV D8VTU1A5SxStmXDS2WAVx8ZsEo7fARu5Iu6xa5b6Eidwh8p/cey6tAD7wJZnC5fad7VMh+ S601SM1MuX7i1YQWU/xJPLCFEWkMvtzEaIVylAGzJDkOoEf8Ct+BTOO4hPNEVFOiKMxFOw eRDQW5Ul+lcBnE5IEigtZLtveLqy9upnF2gDOjIaqnTzyLX5og/dGb9S4sIskQ== 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 BDB0D525F; Fri, 4 Feb 2022 14:23:22 +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 214ENM9c051046; Fri, 4 Feb 2022 14:23:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 214ENM1e051036; Fri, 4 Feb 2022 14:23:22 GMT (envelope-from git) Date: Fri, 4 Feb 2022 14:23:22 GMT Message-Id: <202202041423.214ENM1e051036@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: 7d296e1f0d8d - stable/12 - pf: ensure we don't destroy an uninitialised lock 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: 7d296e1f0d8d39a4d455ec049e2232638b6ecaf3 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643984603; 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=A81+l9K3MIm73G2IwGsE1PiDnwFX+9qQHPoCXbNBYA0=; b=b9LgStKbrY/EoFWYipmGSO5HsHfEenoTv/37wsqKpLYXYe42YMc07uhhpdDErEmkiB634W nEErdHVNsnt52ivi8E09OBBmLMQreznU4VADbS2wto0/QWA/bY1LSIdw9V2w/H2pH2cTWI Lw1+QzSshPViR3iZS3KjlXztnUcc9r+tjQc0W3YNex3pVBoTPh8ZeaKSNIZSWLfA7oyncE T04bgpfKWx6AljVdku4XSMaVxuiMMIDox83uPETvK63m9WC/mQ8hu0GxPXoXhfLoyotS7n L06T2RGIOQhDkFAjrcpe7lPZtxG5OZ3RqGUZFs7jG4e2dla8YHKLS7VMQBwMWQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1643984603; a=rsa-sha256; cv=none; b=cno4BnW/C/yLoqHeB1JAKz+VAM0lwNo61aStfE1VvP4y80MqIovKKGbIR91zUWskHM7989 Z3WEYeeZC2rjDTCtz/D6L8BWgim1KU0izTKJeOaefrYxAd4shUvWauolKfoXfxdLjtGGjq MK1szg6q/ZF9bytyzsKHvlRywGXiceRtT4BJy0hru1VYkB3HFTocbwy85xrL73PCisqSuw DLGtduwRKxGPpda35nSS66Ld/3hcFaZeDEeNpBlzOwE2Tv6+nXH05ORfCFNnZ7fOHh1hzO HYhzl795e/Uw1uBOb9++/UDWupuPrBTXKWDpUDb1Dt31k8InSFsDwSnE37d3Bg== 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=7d296e1f0d8d39a4d455ec049e2232638b6ecaf3 commit 7d296e1f0d8d39a4d455ec049e2232638b6ecaf3 Author: Kristof Provost AuthorDate: 2022-01-16 07:52:18 +0000 Commit: Kristof Provost CommitDate: 2022-02-04 10:38:07 +0000 pf: ensure we don't destroy an uninitialised lock The new lock introduced in 5f5e32f1b3 needs to be initialised early so that it can be safely destroyed if we error out. Reported-by: syzbot+d76113e9a4ae0c0fcac2@syzkaller.appspotmail.com MFC after: 3 weeks Sponsored by: Rubicon Communications, LLC ("Netgate") (cherry picked from commit e5ca5e801d3c806a767c427360c48e935a5facd4) --- sys/netpfil/pf/pf_ioctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/netpfil/pf/pf_ioctl.c b/sys/netpfil/pf/pf_ioctl.c index 48bbfe53b948..4774d88be65c 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -1970,6 +1970,8 @@ pf_ioctl_addrule(struct pf_krule *rule, uint32_t ticket, int rs_num; int error = 0; + mtx_init(&rule->rpool.mtx, "pf_krule_pool", NULL, MTX_DEF); + if ((rule->return_icmp >> 8) > ICMP_MAXTYPE) { error = EINVAL; goto errout_unlocked; @@ -2110,7 +2112,6 @@ pf_ioctl_addrule(struct pf_krule *rule, uint32_t ticket, rule, entries); ruleset->rules[rs_num].inactive.rcount++; - mtx_init(&rule->rpool.mtx, "pf_krule_pool", NULL, MTX_DEF); PF_RULES_WUNLOCK(); return (0);