Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 May 2026 19:44:49 +0000
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 7bdf2b5d5fba - main - nullfs: do not allow to mount a vnode over itself
Message-ID:  <6a0a1ab1.366ed.93367f9@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=7bdf2b5d5fbabfc8749c4ff6e618c3e843b14de0

commit 7bdf2b5d5fbabfc8749c4ff6e618c3e843b14de0
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-05-16 22:16:45 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
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 <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
---
 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.
 	 */


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a0a1ab1.366ed.93367f9>