From nobody Fri Feb 4 14:23:23 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 D4C6B19A805C; Fri, 4 Feb 2022 14:23:24 +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 4JqySX2tG4z4Ryk; Fri, 4 Feb 2022 14:23:24 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643984604; 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=RWi2GsPjZjBUEtHo5e0EH1rLQ9D9gUNUpCX4LhR+P94=; b=apRhLX5BwfezwyQG4xGnt1rJCvp0fN0HmKMVQHMQbtRGKXnorMnlupfnpqS0B1YgB3/sP7 HkjWy1Oev74hxBlz9/wAGRvIsXg8i3LNQKAFeMC6UzCza396rfPtj/9Z+fsHN4OqvvZ4TK qd1lvCIUWujl3yXwQcFfXuU4Q6TrYW/onKSmSfgWn1KrZ9iNvUIn3YUcszdXMX4MHbvwR/ Rm/TP6y17DI36TCy3YDV5ObdsmXN83HyIjpzoC670H9BgWp7EntA/psQDZpL/eVKgix/5M xRkwcVTm60oUV2++Iqavr8KkEI/c6hzVc8rHbedoBXtbKTJkFqOahJlNYTy8SQ== 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 EC136547B; Fri, 4 Feb 2022 14:23:23 +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 214ENN37051148; Fri, 4 Feb 2022 14:23:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 214ENNfP051147; Fri, 4 Feb 2022 14:23:23 GMT (envelope-from git) Date: Fri, 4 Feb 2022 14:23:23 GMT Message-Id: <202202041423.214ENNfP051147@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: ba4b345345ee - stable/13 - 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/13 X-Git-Reftype: branch X-Git-Commit: ba4b345345eeb253b86d4515b2d30f27fa81956c Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1643984604; 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=RWi2GsPjZjBUEtHo5e0EH1rLQ9D9gUNUpCX4LhR+P94=; b=VqjIVhjswvMGjgK44wAfAZ12OwADpcJo7an0KIlNcbMIfpdQdpJILNv+WgNi/15wbo9Iea Tew6JuHfdWG+ThOVLZ/3wUII+vLiFKvJYamU7lVZZG7SXHFtsZ1GAmI3MMNbfywEFITQbh OakiEN/1oT4Ok/NcaReLTkEvg6eJx4I8t5XyDspCYCp1WjK1oMyHrsGCt9Zrm5watR2AOM 7rsCS1DlCdQzO1biIPCdVzn4yW0lYsI8/rTZl0Nfh2KH4s9plGfpqwxJM/NSX/QzEaeozL efjKXfOblOBuQxdKWi9o26QfwmDLtRaAug7gF7m4HNHyCnd7P1aLQIvKjzyb3Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1643984604; a=rsa-sha256; cv=none; b=J2tUNueDDABi4lFc88Dao8mJxSYoCVPqQTFnh3eR1LU/NTMzIgpeNHSfSUuZ7ord+nYoib B9fBRJde8TaJZ63wkSMiY30lnT5o3RDSHOROQHxWnocb1fLhmM6AbTZuO+Rm8vCt5HZYTH 8U+wp7H9LZB9DHpo2t+ld1/gyc4B2BMXAYgleMGrhLKpmJ7vWXusKi/jHdWHu0w1HbTpTs KRXJzzWpX8l2jbgY4SWLrjJXg8zW73ZYfKWw48oyElrms4QxZtctweBXjQ5zJTEyDnVZdU 0GWMYuBaOPYUOybqEmPvBCSWozxZaKTXqkE4bGfYDT4T8dIUUPREHt8hWIT/Hw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=ba4b345345eeb253b86d4515b2d30f27fa81956c commit ba4b345345eeb253b86d4515b2d30f27fa81956c Author: Kristof Provost AuthorDate: 2022-01-16 07:52:18 +0000 Commit: Kristof Provost CommitDate: 2022-02-04 10:38:09 +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 0122389c0b08..e6f23fb4ed34 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -2009,6 +2009,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; @@ -2149,7 +2151,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);