git: 4eddc15ecbb4 - releng/15.2 - lookup: hold ni_rbeneath_dpp
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 17 Nov 2026 17:09:37 UTC
The branch releng/15.2 has been updated by markj:
URL: https://cgit.FreeBSD.org/src/commit/?id=4eddc15ecbb47887f7a63335010bd3f43631a206
commit 4eddc15ecbb47887f7a63335010bd3f43631a206
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-10-23 03:59:15 +0000
Commit: Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-11-17 13:34:45 +0000
lookup: hold ni_rbeneath_dpp
The vnode is held to ensure the validity of the pointer.
Approved by: re (cperciva)
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 6f06fc8268fc..0a6e85d4f2ee 100644
--- a/sys/kern/vfs_lookup.c
+++ b/sys/kern/vfs_lookup.c
@@ -258,6 +258,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;
+ }
}
/*
@@ -419,8 +423,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.