svn commit: r366020 - head/sys/kern

Konstantin Belousov kib at FreeBSD.org
Tue Sep 22 22:36:03 UTC 2020


Author: kib
Date: Tue Sep 22 22:36:02 2020
New Revision: 366020
URL: https://svnweb.freebsd.org/changeset/base/366020

Log:
  Only clear latch for BENEATH when we walk out of the startdir,
  
  not unconditionally on any dotdot component.
  
  Reviewed by:	markj
  Tested by:	pho
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week
  Differential revision:	https://reviews.freebsd.org/D25886

Modified:
  head/sys/kern/vfs_lookup.c

Modified: head/sys/kern/vfs_lookup.c
==============================================================================
--- head/sys/kern/vfs_lookup.c	Tue Sep 22 22:23:58 2020	(r366019)
+++ head/sys/kern/vfs_lookup.c	Tue Sep 22 22:36:02 2020	(r366020)
@@ -238,13 +238,14 @@ nameicap_check_dotdot(struct nameidata *ndp, struct vn
 		return (ENOTCAPABLE);
 	TAILQ_FOREACH_REVERSE(nt, &ndp->ni_cap_tracker, nameicap_tracker_head,
 	    nm_link) {
+		if ((ndp->ni_lcf & NI_LCF_LATCH) != 0 &&
+		    ndp->ni_beneath_latch == nt->dp) {
+			ndp->ni_lcf &= ~NI_LCF_BENEATH_LATCHED;
+			nameicap_cleanup(ndp, false);
+			return (0);
+		}
 		if (dp == nt->dp)
 			return (0);
-	}
-	if ((ndp->ni_lcf & NI_LCF_BENEATH_ABS) != 0) {
-		ndp->ni_lcf &= ~NI_LCF_BENEATH_LATCHED;
-		nameicap_cleanup(ndp, false);
-		return (0);
 	}
 	return (ENOTCAPABLE);
 }


More information about the svn-src-all mailing list