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
This commit is contained in:
Konstantin Belousov 2020-09-22 22:36:02 +00:00
parent 4a0b316d2a
commit 07e7ad2b98
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=366020

View File

@ -238,14 +238,15 @@ nameicap_check_dotdot(struct nameidata *ndp, struct vnode *dp)
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);
}