git: 3111810e08af - stable/15 - lookup: hold ni_rbeneath_dpp
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 17 Nov 2026 17:05:56 UTC
The branch stable/15 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=3111810e08af18fd546cc0065c773e6ddb254270
commit 3111810e08af18fd546cc0065c773e6ddb254270
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-10-23 03:59:15 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-11-17 16:57:22 +0000
lookup: hold ni_rbeneath_dpp
The vnode is held to ensure the validity of the pointer.
Approved by: so
Security: FreeBSD-SA-26:81.vfs
Reported by: pjd
Sponsored by: The FreeBSD Foundation
---
sys/kern/vfs_lookup.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c
index 9b000aeea65d..b1a39bf54bdb 100644
--- a/sys/kern/vfs_lookup.c
+++ b/sys/kern/vfs_lookup.c
@@ -261,6 +261,10 @@ nameicap_cleanup(struct nameidata *ndp, int error)
vfs_rel(mp);
ndp->ni_nctrack_mnt = NULL;
}
+ if (ndp->ni_rbeneath_dpp != NULL) {
+ vdrop(ndp->ni_rbeneath_dpp);
+ ndp->ni_rbeneath_dpp = NULL;
+ }
}
/*
@@ -422,8 +426,10 @@ namei_setup(struct nameidata *ndp, struct vnode **dpp, struct pwd **pwdp)
NI_LCF_CAP_DOTDOT;
}
}
- if (error == 0 && (ndp->ni_lcf & NI_LCF_STRICTREL) != 0)
+ if (error == 0 && (ndp->ni_lcf & NI_LCF_STRICTREL) != 0) {
ndp->ni_rbeneath_dpp = *dpp;
+ vholdnz(*dpp);
+ }
/*
* If we are auditing the kernel pathname, save the user pathname.