ext2_vfsops.c (162647) | ext2_vfsops.c (164033) |
---|---|
1/*- 2 * modified for EXT2FS support in Lites 1.1 3 * 4 * Aug 1995, Godmar Back (gback@cs.utah.edu) 5 * University of Utah, Department of Computer Science 6 */ 7/*- 8 * Copyright (c) 1989, 1991, 1993, 1994 --- 19 unchanged lines hidden (view full) --- 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * 35 * @(#)ffs_vfsops.c 8.8 (Berkeley) 4/18/94 | 1/*- 2 * modified for EXT2FS support in Lites 1.1 3 * 4 * Aug 1995, Godmar Back (gback@cs.utah.edu) 5 * University of Utah, Department of Computer Science 6 */ 7/*- 8 * Copyright (c) 1989, 1991, 1993, 1994 --- 19 unchanged lines hidden (view full) --- 28 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * SUCH DAMAGE. 34 * 35 * @(#)ffs_vfsops.c 8.8 (Berkeley) 4/18/94 |
36 * $FreeBSD: head/sys/gnu/fs/ext2fs/ext2_vfsops.c 162647 2006-09-26 04:12:49Z tegge $ | 36 * $FreeBSD: head/sys/gnu/fs/ext2fs/ext2_vfsops.c 164033 2006-11-06 13:42:10Z rwatson $ |
37 */ 38 39/*- 40 * COPYRIGHT.INFO says this has some GPL'd code from ext2_super.c in it 41 * 42 * This program is free software; you can redistribute it and/or modify 43 * it under the terms of the GNU General Public License as published by 44 * the Free Software Foundation; either version 2 of the License. --- 7 unchanged lines hidden (view full) --- 52 * along with this program; if not, write to the Free Software 53 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 54 * 55 */ 56 57#include <sys/param.h> 58#include <sys/systm.h> 59#include <sys/namei.h> | 37 */ 38 39/*- 40 * COPYRIGHT.INFO says this has some GPL'd code from ext2_super.c in it 41 * 42 * This program is free software; you can redistribute it and/or modify 43 * it under the terms of the GNU General Public License as published by 44 * the Free Software Foundation; either version 2 of the License. --- 7 unchanged lines hidden (view full) --- 52 * along with this program; if not, write to the Free Software 53 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 54 * 55 */ 56 57#include <sys/param.h> 58#include <sys/systm.h> 59#include <sys/namei.h> |
60#include <sys/priv.h> |
|
60#include <sys/proc.h> 61#include <sys/kernel.h> 62#include <sys/vnode.h> 63#include <sys/mount.h> 64#include <sys/bio.h> 65#include <sys/buf.h> 66#include <sys/conf.h> 67#include <sys/fcntl.h> --- 124 unchanged lines hidden (view full) --- 192 devvp = ump->um_devvp; 193 if (fs->s_rd_only && !vfs_flagopt(opts, "ro", NULL, 0)) { 194 if (ext2_check_sb_compat(fs->s_es, devvp->v_rdev, 0)) 195 return (EPERM); 196 /* 197 * If upgrade to read-write by non-root, then verify 198 * that user has necessary permissions on the device. 199 */ | 61#include <sys/proc.h> 62#include <sys/kernel.h> 63#include <sys/vnode.h> 64#include <sys/mount.h> 65#include <sys/bio.h> 66#include <sys/buf.h> 67#include <sys/conf.h> 68#include <sys/fcntl.h> --- 124 unchanged lines hidden (view full) --- 193 devvp = ump->um_devvp; 194 if (fs->s_rd_only && !vfs_flagopt(opts, "ro", NULL, 0)) { 195 if (ext2_check_sb_compat(fs->s_es, devvp->v_rdev, 0)) 196 return (EPERM); 197 /* 198 * If upgrade to read-write by non-root, then verify 199 * that user has necessary permissions on the device. 200 */ |
200 if (suser(td)) { 201 vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td); 202 if ((error = VOP_ACCESS(devvp, VREAD | VWRITE, 203 td->td_ucred, td)) != 0) { 204 VOP_UNLOCK(devvp, 0, td); 205 return (error); 206 } | 201 vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td); 202 error = VOP_ACCESS(devvp, VREAD | VWRITE, 203 td->td_ucred, td); 204 if (error) 205 error = priv_check(td, PRIV_VFS_MOUNT_PERM); 206 if (error) { |
207 VOP_UNLOCK(devvp, 0, td); | 207 VOP_UNLOCK(devvp, 0, td); |
208 return (error); |
|
208 } | 209 } |
210 VOP_UNLOCK(devvp, 0, td); |
|
209 DROP_GIANT(); 210 g_topology_lock(); 211 error = g_access(ump->um_cp, 0, 1, 0); 212 g_topology_unlock(); 213 PICKUP_GIANT(); 214 if (error) 215 return (error); 216 --- 37 unchanged lines hidden (view full) --- 254 if (!vn_isdisk(devvp, &error)) { 255 vput(devvp); 256 return (error); 257 } 258 259 /* 260 * If mount by non-root, then verify that user has necessary 261 * permissions on the device. | 211 DROP_GIANT(); 212 g_topology_lock(); 213 error = g_access(ump->um_cp, 0, 1, 0); 214 g_topology_unlock(); 215 PICKUP_GIANT(); 216 if (error) 217 return (error); 218 --- 37 unchanged lines hidden (view full) --- 256 if (!vn_isdisk(devvp, &error)) { 257 vput(devvp); 258 return (error); 259 } 260 261 /* 262 * If mount by non-root, then verify that user has necessary 263 * permissions on the device. |
264 * 265 * XXXRW: VOP_ACCESS() enough? |
|
262 */ | 266 */ |
263 if (suser(td)) { 264 accessmode = VREAD; 265 if ((mp->mnt_flag & MNT_RDONLY) == 0) 266 accessmode |= VWRITE; 267 if ((error = VOP_ACCESS(devvp, accessmode, td->td_ucred, td)) != 0) { 268 vput(devvp); 269 return (error); 270 } | 267 accessmode = VREAD; 268 if ((mp->mnt_flag & MNT_RDONLY) == 0) 269 accessmode |= VWRITE; 270 error = VOP_ACCESS(devvp, accessmode, td->td_ucred, td); 271 if (error) 272 error = priv_check(td, PRIV_VFS_MOUNT_PERM); 273 if (error) { 274 vput(devvp); 275 return (error); |
271 } 272 273 if ((mp->mnt_flag & MNT_UPDATE) == 0) { 274 error = ext2_mountfs(devvp, mp, td); 275 } else { 276 if (devvp != ump->um_devvp) { 277 vput(devvp); 278 return (EINVAL); /* needs translation */ --- 884 unchanged lines hidden --- | 276 } 277 278 if ((mp->mnt_flag & MNT_UPDATE) == 0) { 279 error = ext2_mountfs(devvp, mp, td); 280 } else { 281 if (devvp != ump->um_devvp) { 282 vput(devvp); 283 return (EINVAL); /* needs translation */ --- 884 unchanged lines hidden --- |