git: 6e45b50342d5 - main - mac_veriexec_parser: Fix open_file error handling
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 20 Sep 2024 15:58:12 UTC
The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=6e45b50342d5adadf9dd08e3476fc90f715be1fc commit 6e45b50342d5adadf9dd08e3476fc90f715be1fc Author: Heyang Zhou <hello@su3.io> AuthorDate: 2024-07-22 17:43:28 +0000 Commit: Warner Losh <imp@FreeBSD.org> 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 <mindal@semihalf.com>, 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);