git: cef8a95acbae - main - vfs: fix vnode use count leak in O_EMPTY_PATH support

Mateusz Guzik mjg at FreeBSD.org
Thu May 13 09:39:41 UTC 2021


The branch main has been updated by mjg:

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

commit cef8a95acbae0c3043d95028d8ebb24d959a82a0
Author:     Mateusz Guzik <mjg at FreeBSD.org>
AuthorDate: 2021-05-13 09:23:03 +0000
Commit:     Mateusz Guzik <mjg at FreeBSD.org>
CommitDate: 2021-05-13 09:39:27 +0000

    vfs: fix vnode use count leak in O_EMPTY_PATH support
    
    The vnode returned by namei_setup is already referenced.
    
    Reported by:    pho
---
 sys/kern/vfs_lookup.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c
index 3050275c1b6f..5336bf87ec68 100644
--- a/sys/kern/vfs_lookup.c
+++ b/sys/kern/vfs_lookup.c
@@ -495,8 +495,10 @@ namei_emptypath(struct nameidata *ndp)
 		goto errout;
 	}
 
+	/*
+	 * Usecount on dp already provided by namei_setup.
+	 */
 	ndp->ni_vp = dp;
-	vref(dp);
 	namei_cleanup_cnp(cnp);
 	pwd_drop(pwd);
 	ndp->ni_resflags |= NIRES_EMPTYPATH;


More information about the dev-commits-src-all mailing list