The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=7bdf2b5d5fbabfc8749c4ff6e618c3e843b14de0
commit 7bdf2b5d5fbabfc8749c4ff6e618c3e843b14de0 Author: Konstantin Belousov <[email protected]> AuthorDate: 2026-05-16 22:16:45 +0000 Commit: Konstantin Belousov <[email protected]> CommitDate: 2026-05-17 19:44:06 +0000 nullfs: do not allow to mount a vnode over itself This causes recursion in VFS that is not worth handling. PR: 275570 Reported by: Alex S <[email protected]> Reviewed by: markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D57043 --- sys/fs/nullfs/null_vfsops.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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 @@ -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. */
