aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/kern/vfs_mount.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c
index b3870e46c5e9..59000728efcc 100644
--- a/sys/kern/vfs_mount.c
+++ b/sys/kern/vfs_mount.c
@@ -918,10 +918,10 @@ vfs_domount_first(
/*
* If the jail of the calling thread lacks permission for this type of
- * file system, deny immediately.
+ * file system, or is trying to cover its own root, deny immediately.
*/
- if (jailed(td->td_ucred) && !prison_allow(td->td_ucred,
- vfsp->vfc_prison_flag)) {
+ if (jailed(td->td_ucred) && (!prison_allow(td->td_ucred,
+ vfsp->vfc_prison_flag) || vp == td->td_ucred->cr_prison->pr_root)) {
vput(vp);
return (EPERM);
}