The branch stable/13 has been updated by kib:

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

commit 68230041eb292f26132c73de9369e695ab6ada6e
Author:     Konstantin Belousov <[email protected]>
AuthorDate: 2021-02-28 00:14:43 +0000
Commit:     Konstantin Belousov <[email protected]>
CommitDate: 2021-03-04 19:11:05 +0000

    Add nameicap_cleanup_from(), to clean tracker list starting from some 
element
    
    (cherry picked from commit e8a2862aa0384c75603f801625e309a3dae0ed05)
---
 sys/kern/vfs_lookup.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c
index cdd4a914239f..abc01c73e24c 100644
--- a/sys/kern/vfs_lookup.c
+++ b/sys/kern/vfs_lookup.c
@@ -192,19 +192,26 @@ nameicap_tracker_add(struct nameidata *ndp, struct vnode 
*dp)
 }
 
 static void
-nameicap_cleanup(struct nameidata *ndp)
+nameicap_cleanup_from(struct nameidata *ndp, struct nameicap_tracker *first)
 {
        struct nameicap_tracker *nt, *nt1;
 
-       KASSERT(TAILQ_EMPTY(&ndp->ni_cap_tracker) ||
-           (ndp->ni_lcf & NI_LCF_CAP_DOTDOT) != 0, ("not strictrelative"));
-       TAILQ_FOREACH_SAFE(nt, &ndp->ni_cap_tracker, nm_link, nt1) {
+       nt = first;
+       TAILQ_FOREACH_FROM_SAFE(nt, &ndp->ni_cap_tracker, nm_link, nt1) {
                TAILQ_REMOVE(&ndp->ni_cap_tracker, nt, nm_link);
                vdrop(nt->dp);
                free(nt, M_NAMEITRACKER);
        }
 }
 
+static void
+nameicap_cleanup(struct nameidata *ndp)
+{
+       KASSERT(TAILQ_EMPTY(&ndp->ni_cap_tracker) ||
+           (ndp->ni_lcf & NI_LCF_CAP_DOTDOT) != 0, ("not strictrelative"));
+       nameicap_cleanup_from(ndp, NULL);
+}
+
 /*
  * For dotdot lookups in capability mode, only allow the component
  * lookup to succeed if the resulting directory was already traversed
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to