diff --git a/sys/fs/nullfs/null_vfsops.c b/sys/fs/nullfs/null_vfsops.c index c3eec727aee..0ec4f9c8729 100644 --- a/sys/fs/nullfs/null_vfsops.c +++ b/sys/fs/nullfs/null_vfsops.c @@ -151,6 +151,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. */