aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/fs/nullfs/null_vfsops.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/fs/nullfs/null_vfsops.c b/sys/fs/nullfs/null_vfsops.c
index c3eec727aeea..0ec4f9c87297 100644
--- a/sys/fs/nullfs/null_vfsops.c
+++ b/sys/fs/nullfs/null_vfsops.c
@@ -152,6 +152,14 @@ nullfs_mount(struct mount *mp)
lowerrootvp = ndp->ni_vp;
/*
+ * Do not allow to mount a vnode over itself.
+ */
+ if (mp->mnt_vnodecovered == lowerrootvp) {
+ vput(lowerrootvp);
+ return (EDEADLK);
+ }
+
+ /*
* Check multi null mount to avoid `lock against myself' panic.
*/
if (null_is_nullfs_vnode(mp->mnt_vnodecovered)) {