From owner-p4-projects Tue Jun 4 7:42:24 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 9496C37B409; Tue, 4 Jun 2002 07:39:37 -0700 (PDT) Delivered-To: perforce@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 370AD37B421 for ; Tue, 4 Jun 2002 07:38:35 -0700 (PDT) Received: (from perforce@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g54EcYd32175 for perforce@freebsd.org; Tue, 4 Jun 2002 07:38:34 -0700 (PDT) (envelope-from bb+lists.freebsd.perforce@cyrus.watson.org) Date: Tue, 4 Jun 2002 07:38:34 -0700 (PDT) Message-Id: <200206041438.g54EcYd32175@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: perforce set sender to bb+lists.freebsd.perforce@cyrus.watson.org using -f From: Robert Watson Subject: PERFORCE change 12358 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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