diff options
author | Konstantin Belousov <kib@FreeBSD.org> | 2021-02-28 00:13:19 +0000 |
---|---|---|
committer | Konstantin Belousov <kib@FreeBSD.org> | 2021-03-04 19:11:00 +0000 |
commit | 11c6aa5c504d76e50dcd9481020c0f350ce0bb00 (patch) | |
tree | e0f8581382dd2f5f6558a35de38985637f35b302 | |
parent | 7a1e21f194e44d57f4d89012b5d7dd61668d7da8 (diff) | |
download | src-11c6aa5c504d76e50dcd9481020c0f350ce0bb00.tar.gz src-11c6aa5c504d76e50dcd9481020c0f350ce0bb00.zip |
nameicap_tracker_add: avoid duplicates in the tracker list
(cherry picked from commit 2388ad7c293fbc89ee239a1adcb87fd158c4e8e9)
-rw-r--r-- | sys/kern/vfs_lookup.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index 73290e8da05f..cdd4a914239f 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -182,6 +182,9 @@ nameicap_tracker_add(struct nameidata *ndp, struct vnode *dp) if ((ndp->ni_lcf & NI_LCF_CAP_DOTDOT) == 0 || dp->v_type != VDIR) return; cnp = &ndp->ni_cnd; + nt = TAILQ_LAST(&ndp->ni_cap_tracker, nameicap_tracker_head); + if (nt != NULL && nt->dp == dp) + return; nt = malloc(sizeof(*nt), M_NAMEITRACKER, M_WAITOK); vhold(dp); nt->dp = dp; |