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 <iwtcex@gmail.com>
Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D57043
This commit is contained in:
Konstantin Belousov
2026-05-17 01:16:45 +03:00
parent 363ea40c76
commit 7bdf2b5d5f
+8
View File
@@ -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.
*/