From nobody Fri Sep 20 15:58:12 2024 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 4X9H9J5X5rz5XgGZ; Fri, 20 Sep 2024 15:58: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4X9H9J42sqz4dmB; Fri, 20 Sep 2024 15:58:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1726847892; 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=arBqFDIHoE0IyhnLdC8CutR4avnzn+CqrujZPmcXzbc=; b=MEV4LtE0QPXaCIg37WjFqtEq4el7uypIkaeaQa363ffB6xGrK2vp2jKM6yngedHIi+BEYF MrDhhlOoJlXQzKLNc0swPcR1ZSvUr3C391NeeTAPk72L2HOkpFGpQYefIfHtSW4Jj4ISrZ N4IY8fRCKVfKaF52g7yCbfIW3Clq0MjrR3hAN51oP/O6J3iFo2uT4gSBuPqPmwgg6Ifqwm JXz7M0pHPtcYRnA/EZ2fbtUbzKsdoGc/cqygrRjgU96QcPCfm18uSJMAWmi4VpZcj54ANj kyPBeI0iOUWNTOIzRfN0jgDr7k6gbdGI0BBIqK/TUUAe7OPWAFvkeSP5QEij3w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1726847892; a=rsa-sha256; cv=none; b=YtzLY4dVSKRoYozqIWcK0bgzKehWPMGipaYMq63l9Y4N/Nf3JQ3YHZXJMXxhy9aCxzsmjT g1MV+F9ADZsdmTV0aH2caAIX7ranrTQYZZeN+f27Xt9pUnvl78oGQSb//AktaKAiq+ouBd axWLn4tWtZ6nZc1cjTddwS/9AvbvhDC0j+506CcNemS9xgY8AZEpHseAJcb9SJhUDEBltO Yro3Aav86IKn4kEHhSgQWkdkGI9aJOwce7uQs0FTkrUrWLPXHjyAT7IvVF64CFv6lByskF /coKU2SpQTeBNx+Sh8im017lQJYiQb277KEgjDcjdrwlqiroTiJndNNRByEv2g== 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=1726847892; 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=arBqFDIHoE0IyhnLdC8CutR4avnzn+CqrujZPmcXzbc=; b=m2VuE9w3S0hDa/1Xe0eR6sgymqW8JpQzeqid1Kc2cLwFbYnXctnxndjW862mmHKff5aDSA OXm7D4Q5bL7lQLtMqtkfPg0135SWAxw7SSoezTtPIeDXTQEchlygEBh5J2Xu4enPPT2omk TYDMiow/3UraNPEQ/dccbsTc4VhDfoGkIcUQ5KMbZ2JAdR63m4QSr3wTZFrQL/q/lw4yct BZLY8pDp+X8SV42WnRBaTj9D1AC4zs7Ou58+J/CXR0q8aNC3IqHI0Zz64lWRaEfJWyckMK xkSw4s0iKhHVAFOzedpp4H0cWa3Eb2p8ZZmToOvDfKoP+Axq/olxX2s1oyiBJQ== 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 4X9H9J3YzQzwYp; Fri, 20 Sep 2024 15:58:12 +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 48KFwCf7048937; Fri, 20 Sep 2024 15:58:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 48KFwCob048934; Fri, 20 Sep 2024 15:58:12 GMT (envelope-from git) Date: Fri, 20 Sep 2024 15:58:12 GMT Message-Id: <202409201558.48KFwCob048934@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 6e45b50342d5 - main - mac_veriexec_parser: Fix open_file error handling 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6e45b50342d5adadf9dd08e3476fc90f715be1fc Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=6e45b50342d5adadf9dd08e3476fc90f715be1fc commit 6e45b50342d5adadf9dd08e3476fc90f715be1fc Author: Heyang Zhou AuthorDate: 2024-07-22 17:43:28 +0000 Commit: Warner Losh CommitDate: 2024-09-20 15:22:56 +0000 mac_veriexec_parser: Fix open_file error handling NDFREE_PNBUF should be called after checking the return value of vn_open(), and should only be called once. Reviewed by: imp, zlei, Kornel Dulęba , Elliott Mitchell Pull Request: https://github.com/freebsd/freebsd-src/pull/1338 --- sys/security/mac_veriexec_parser/mac_veriexec_parser.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sys/security/mac_veriexec_parser/mac_veriexec_parser.c b/sys/security/mac_veriexec_parser/mac_veriexec_parser.c index 26ba573a2130..442f333d5107 100644 --- a/sys/security/mac_veriexec_parser/mac_veriexec_parser.c +++ b/sys/security/mac_veriexec_parser/mac_veriexec_parser.c @@ -241,9 +241,9 @@ open_file(const char *path, struct nameidata *nid) NDINIT(nid, LOOKUP, 0, UIO_SYSSPACE, path); rc = vn_open(nid, &flags, 0, NULL); - NDFREE_PNBUF(nid); if (rc != 0) return (rc); + NDFREE_PNBUF(nid); return (0); } @@ -346,7 +346,6 @@ parse_entry(char *entry, char *prefix) } rc = open_file(path, &nid); - NDFREE_PNBUF(&nid); if (rc != 0) return (rc);