aboutsummaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2026-06-04 19:56:36 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2026-06-06 03:28:28 +0000
commitd53633bfcf24a3eb3711e24b597aa8301f92b958 (patch)
tree5a9627bce146c006d3e7e6676e20204ede4a48a2 /sys/kern
parent5d0ebfe1d97801518755c7025f57ba7d5bf1c8db (diff)
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/vfs_lookup.c2
-rw-r--r--sys/kern/vfs_syscalls.c9
2 files changed, 10 insertions, 1 deletions
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c
index c1363c0104d3..5d66070ca142 100644
--- a/sys/kern/vfs_lookup.c
+++ b/sys/kern/vfs_lookup.c
@@ -113,7 +113,7 @@ SDT_PROBE_DEFINE4(vfs, namei, lookup, return, "int", "struct vnode *", "bool",
uma_zone_t namei_zone;
/* Placeholder vnode for mp traversal. */
-static struct vnode *vp_crossmp;
+struct vnode *vp_crossmp;
static int
crossmp_vop_islocked(struct vop_islocked_args *ap)
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 71d37e08c65b..7ca7ccd582e1 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -3823,6 +3823,15 @@ again:
}
tdvp = tond.ni_dvp;
tvp = tond.ni_vp;
+ if (tdvp == vp_crossmp) {
+ /*
+ * Rename of the root vnode of the mounted
+ * filesystem. It is possible to get there with the
+ * nullfs mount over the regular file.
+ */
+ error = EBUSY;
+ goto out;
+ }
if (tvp != NULL && (flags & AT_RENAME_NOREPLACE) != 0) {
/*
* Often filesystems need to relock the vnodes in