git: ee4316c0c357 - stable/15 - vfs: Fix resource leaks in kern_symlinkat()

Mark Johnston <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src
Message-ID <6a67ae2a.37d40.565debff__20418.0429385573$1785179731$gmane$org@gitrepo.freebsd.org>
The branch stable/15 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=ee4316c0c3575948bb6d8eb654b07932ba51736f

commit ee4316c0c3575948bb6d8eb654b07932ba51736f
Author:     Mark Johnston <[email protected]>
AuthorDate: 2026-07-06 15:42:52 +0000
Commit:     Mark Johnston <[email protected]>
CommitDate: 2026-07-27 17:34:31 +0000

    vfs: Fix resource leaks in kern_symlinkat()
    
    Fixes:          2ec2ba7e232d ("vfs: Add VFS/syscall support for Solaris style extended attributes")
    Reported by:    Yuxiang Yang, Yizhou Zhao, Ao Wang, Xuewei Feng, Qi Li,
                    and Ke Xu from Tsinghua University using GLM-5.2 from Z.ai
    Reviewed by:    rmacklem, kib
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D58053
    
    (cherry picked from commit 58c73727d6e49de1fc4f4bc90621146cae8db2bc)
---
 sys/kern/vfs_syscalls.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index a6f513b719ba..c27671bcfc28 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -1882,7 +1882,7 @@ restart:
 	}
 	if ((vn_irflag_read(nd.ni_dvp) & VIRF_NAMEDDIR) != 0) {
 		error = EINVAL;
-		goto out;
+		goto out2;
 	}
 	VATTR_NULL(&vattr);
 	vattr.va_mode = ACCESSPERMS &~ td->td_proc->p_pd->pd_cmask;
@@ -1894,9 +1894,7 @@ restart:
 		goto out2;
 #endif
 	error = VOP_SYMLINK(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr, syspath);
-#ifdef MAC
 out2:
-#endif
 	VOP_VPUT_PAIR(nd.ni_dvp, error == 0 ? &nd.ni_vp : NULL, true);
 	vn_finished_write(mp);
 	NDFREE_PNBUF(&nd);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.