git: ee389afecf85 - stable/13 - nullfs: protect against user creating inconsistent state
Konstantin Belousov
kib at FreeBSD.org
Fri Apr 9 04:57:20 UTC 2021
The branch stable/13 has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=ee389afecf85571936957b183921165893c680a6
commit ee389afecf85571936957b183921165893c680a6
Author: Konstantin Belousov <kib at FreeBSD.org>
AuthorDate: 2021-04-01 17:42:14 +0000
Commit: Konstantin Belousov <kib at FreeBSD.org>
CommitDate: 2021-04-09 04:52:05 +0000
nullfs: protect against user creating inconsistent state
PR: 253593
(cherry picked from commit 76b1b5ce6d81f66b09be8a20aecd064b65fd6b50)
---
sys/fs/nullfs/null_vnops.c | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
diff --git a/sys/fs/nullfs/null_vnops.c b/sys/fs/nullfs/null_vnops.c
index 45065e0be7b5..607755fd62d9 100644
--- a/sys/fs/nullfs/null_vnops.c
+++ b/sys/fs/nullfs/null_vnops.c
@@ -389,10 +389,21 @@ null_lookup(struct vop_lookup_args *ap)
*/
ldvp = NULLVPTOLOWERVP(dvp);
vp = lvp = NULL;
- KASSERT((ldvp->v_vflag & VV_ROOT) == 0 ||
- ((dvp->v_vflag & VV_ROOT) != 0 && (flags & ISDOTDOT) == 0),
- ("ldvp %p fl %#x dvp %p fl %#x flags %#x", ldvp, ldvp->v_vflag,
- dvp, dvp->v_vflag, flags));
+
+ /*
+ * Renames in the lower mounts might create an inconsistent
+ * configuration where lower vnode is moved out of the
+ * directory tree remounted by our null mount. Do not try to
+ * handle it fancy, just avoid VOP_LOOKUP() with DOTDOT name
+ * which cannot be handled by VOP, at least passing over lower
+ * root.
+ */
+ if ((ldvp->v_vflag & VV_ROOT) != 0 && (flags & ISDOTDOT) != 0) {
+ KASSERT((dvp->v_vflag & VV_ROOT) == 0,
+ ("ldvp %p fl %#x dvp %p fl %#x flags %#x",
+ ldvp, ldvp->v_vflag, dvp, dvp->v_vflag, flags));
+ return (ENOENT);
+ }
/*
* Hold ldvp. The reference on it, owned by dvp, is lost in
More information about the dev-commits-src-branches
mailing list