svn commit: r343898 - head/sys/fs/nullfs

Konstantin Belousov kib at FreeBSD.org
Fri Feb 8 08:17:32 UTC 2019


Author: kib
Date: Fri Feb  8 08:17:31 2019
New Revision: 343898
URL: https://svnweb.freebsd.org/changeset/base/343898

Log:
  Before using VTONULL(), check that the covered vnode belongs to nullfs.
  
  Reported and tested by:	pho
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week

Modified:
  head/sys/fs/nullfs/null_vfsops.c

Modified: head/sys/fs/nullfs/null_vfsops.c
==============================================================================
--- head/sys/fs/nullfs/null_vfsops.c	Fri Feb  8 08:15:29 2019	(r343897)
+++ head/sys/fs/nullfs/null_vfsops.c	Fri Feb  8 08:17:31 2019	(r343898)
@@ -145,10 +145,13 @@ nullfs_mount(struct mount *mp)
 	/*
 	 * Check multi null mount to avoid `lock against myself' panic.
 	 */
-	if (lowerrootvp == VTONULL(mp->mnt_vnodecovered)->null_lowervp) {
-		NULLFSDEBUG("nullfs_mount: multi null mount?\n");
-		vput(lowerrootvp);
-		return (EDEADLK);
+	if (mp->mnt_vnodecovered->v_op == &null_vnodeops) {
+		nn = VTONULL(mp->mnt_vnodecovered);
+		if (nn == NULL || lowerrootvp == nn->null_lowervp) {
+			NULLFSDEBUG("nullfs_mount: multi null mount?\n");
+			vput(lowerrootvp);
+			return (EDEADLK);
+		}
 	}
 
 	xmp = (struct null_mount *) malloc(sizeof(struct null_mount),


More information about the svn-src-head mailing list