From nobody Sun Jan 16 11:48:12 2022 X-Original-To: dev-commits-src-main@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 E1CB3195A909; Sun, 16 Jan 2022 11:48:12 +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 4JcCwD60jnz4hnM; Sun, 16 Jan 2022 11:48:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642333692; 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=N5yPYBcbmhMOfZAE1hGcVZCz/mEKsdyEp62ohbRtyCY=; b=vLBo4hN7slUqeOaapI6ryC1YgOhb+PjcgcOA1ASOu5IPLoD3NFqVWs5dVnt9yTMxRUjX6G f6cWb2U9SU7nG6ma9hQz+5taaO6ou1iPt7ucf74ELZfUbtisT5jbqe+hArqD3Cq0jNzQho 2LQiZ14DdJkHanNA1KpFnjs40Y+6opOubkrZ/hUPoBMldE6ZcOxSGhJfAHRxk3uT2Dp38P w9NpwUX4klgikv31HyYnsZDhSdCpck0Ub3RTqde3bmtdL5MkaNA12xy9OfG64EFP1BsAey nS6FHL0OX/gzMojKIw5Yy4l6TFTUQLXpsihS6Rfhw8RsOD2nHoaumyrCI3keRQ== 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 ADFA419F0B; Sun, 16 Jan 2022 11:48:12 +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 20GBmCfi021291; Sun, 16 Jan 2022 11:48:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 20GBmC6M021290; Sun, 16 Jan 2022 11:48:12 GMT (envelope-from git) Date: Sun, 16 Jan 2022 11:48:12 GMT Message-Id: <202201161148.20GBmC6M021290@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: e5ca5e801d3c - main - pf: ensure we don't destroy an uninitialised lock List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: e5ca5e801d3c806a767c427360c48e935a5facd4 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1642333692; 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=N5yPYBcbmhMOfZAE1hGcVZCz/mEKsdyEp62ohbRtyCY=; b=saq3b+7mtw9AcgfIF8qU/5pzh3rG3h/VX52vg/4WKJtTDxughgDYD2EZdlRwoJTN4EUNIF X4AxoIOlGeMp1cJ1bbYY7GB2CZtQxSMJumOw5dBj1tVXWgf2LFPygT1cecqHc7SbPxN4h+ KuJC56PC2Itd4SrhpXOnNPYgMissKDJLSfa/62fKTa5dITPo4Sp6TDYL298dFl767z/Eal PWvGQmB/ct2Uw69Q7tPJfPUrU60kGGl2HMcQjCIKMU6cSXw6WfHneAFUY71SM2TmKg5bDR Ac1qy+TmlNVy2Zx0o5+RCAmhj7zp1HD3lMs/Re1zvGmuXCA2cJAVnH7f7GV55g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1642333692; a=rsa-sha256; cv=none; b=IKOuKhJdRSKTtTKZzkkUJTB+99AeEvyTFluw/VpmrUs8Rs5l3ZPLAStL3UW2aSJCiAs40D y/9b1NX7QiSm2JQq5294LToU2S3AA+4z48yuib6N5tosV9GEfhcoWqJQgTjqUmdL0pwSYB fPESvZ9SNvymMDVJ66TspIMI1ajeY+OrKWduRNabEae0UqzKwb0AX5KCw4xPS8JbnnIoy5 r9S3YQsXipjFPzmsB3Q5XF9Z1GmvFNi8JTzO7pE4wagbcU+qE83RlaFoBkgOVXdgzxnBPe fMFHA9ra6TIwo9VbkpfyJRYk+glgwR1JJarOP4RiFqHlcEBjbqi2AVkQtD6YoA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=e5ca5e801d3c806a767c427360c48e935a5facd4 commit e5ca5e801d3c806a767c427360c48e935a5facd4 Author: Kristof Provost AuthorDate: 2022-01-16 07:52:18 +0000 Commit: Kristof Provost CommitDate: 2022-01-16 08:04:57 +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") --- 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 20bf8943e774..d66b13f61b79 100644 --- a/sys/netpfil/pf/pf_ioctl.c +++ b/sys/netpfil/pf/pf_ioctl.c @@ -1862,6 +1862,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; @@ -2002,7 +2004,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);