Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Jun 2002 07:38:34 -0700 (PDT)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 12358 for review
Message-ID:  <200206041438.g54EcYd32175@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://people.freebsd.org/~peter/p4db/chv.cgi?CH=12358

Change 12358 by rwatson@rwatson_curry on 2002/06/04 07:37:41

	Fixes to mountpoint labeling and handling -- due to changes brought
	in from the main tree, it was possible for kernel-mounted
	filesystems to not have 'mac_create_mount' called on them.  Reorder
	mounting and labeling code a bit, and attempt to prevent leaking
	struct mount labels in failure modes not previously handled.  This
	prevents a  panic on statfs of devfs.

Affected files ...

... //depot/projects/trustedbsd/mac/sys/kern/vfs_syscalls.c#43 edit

Differences ...

==== //depot/projects/trustedbsd/mac/sys/kern/vfs_syscalls.c#43 (text+ko) ====

@@ -530,6 +530,7 @@
 	mp->mnt_iosize_max = DFLTPHYS;
 #ifdef MAC
 	mac_init_mount(mp);
+	mac_create_mount(td->td_ucred, mp);
 #endif
 	VOP_UNLOCK(vp, 0, td);
 
@@ -550,6 +551,9 @@
 		else {
 			mp->mnt_vfc->vfc_refcount--;
 			vfs_unbusy(mp, td);
+#ifdef MAC
+			mac_destroy_mount(mp);
+#endif
 			free((caddr_t)mp, M_MOUNT);
 		}
 		vput(vp);
@@ -883,6 +887,7 @@
 	mp->mnt_iosize_max = DFLTPHYS;
 #ifdef MAC
 	mac_init_mount(mp);
+	mac_create_mount(td->td_ucred, mp);
 #endif
 	VOP_UNLOCK(vp, 0, td);
 update:
@@ -901,6 +906,9 @@
 		else {
 			mp->mnt_vfc->vfc_refcount--;
 			vfs_unbusy(mp, td);
+#ifdef MAC
+			mac_destroy_mount(mp);
+#endif
 			free((caddr_t)mp, M_MOUNT);
 		}
 		vput(vp);
@@ -947,10 +955,6 @@
 		vrele(vp);
 		return (error);
 	}
-#ifdef MAC
-	if (error == 0)
-		mac_create_mount(td->td_ucred, mp);
-#endif /* MAC */
 	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
 	/*
 	 * Put the new filesystem on the mount list after root.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe p4-projects" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200206041438.g54EcYd32175>