diff options
author | bde <bde@FreeBSD.org> | 2000-03-09 05:21:10 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 2000-03-09 05:21:10 +0000 |
commit | 45f640e388df179b42641eb7ff526b05617cce21 (patch) | |
tree | b89b9a2cdfe8f5eb8184c8561b71f031e7fde851 /sys/gnu | |
parent | 27e4b96f7874e4788444d599a5f26a50c375a56e (diff) | |
download | FreeBSD-src-45f640e388df179b42641eb7ff526b05617cce21.zip FreeBSD-src-45f640e388df179b42641eb7ff526b05617cce21.tar.gz |
Don't forget to check for unsupported features when updating. It was
possible to defeat the check for rw incompatibilty by mounting ro and
updating to rw.
Approved by: jkh
Diffstat (limited to 'sys/gnu')
-rw-r--r-- | sys/gnu/ext2fs/ext2_vfsops.c | 5 | ||||
-rw-r--r-- | sys/gnu/fs/ext2fs/ext2_vfsops.c | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/sys/gnu/ext2fs/ext2_vfsops.c b/sys/gnu/ext2fs/ext2_vfsops.c index ac30793..a56a443 100644 --- a/sys/gnu/ext2fs/ext2_vfsops.c +++ b/sys/gnu/ext2fs/ext2_vfsops.c @@ -218,13 +218,16 @@ ext2_mount(mp, path, data, ndp, p) error = ext2_reload(mp, ndp->ni_cnd.cn_cred, p); if (error) return (error); + devvp = ump->um_devvp; + if (ext2_check_sb_compat(fs->s_es, devvp->v_rdev, + (mp->mnt_kern_flag & MNTK_WANTRDWR) == 0) != 0) + return (EPERM); if (fs->s_rd_only && (mp->mnt_kern_flag & MNTK_WANTRDWR)) { /* * If upgrade to read-write by non-root, then verify * that user has necessary permissions on the device. */ if (p->p_ucred->cr_uid != 0) { - devvp = ump->um_devvp; vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p); if ((error = VOP_ACCESS(devvp, VREAD | VWRITE, p->p_ucred, p)) != 0) { diff --git a/sys/gnu/fs/ext2fs/ext2_vfsops.c b/sys/gnu/fs/ext2fs/ext2_vfsops.c index ac30793..a56a443 100644 --- a/sys/gnu/fs/ext2fs/ext2_vfsops.c +++ b/sys/gnu/fs/ext2fs/ext2_vfsops.c @@ -218,13 +218,16 @@ ext2_mount(mp, path, data, ndp, p) error = ext2_reload(mp, ndp->ni_cnd.cn_cred, p); if (error) return (error); + devvp = ump->um_devvp; + if (ext2_check_sb_compat(fs->s_es, devvp->v_rdev, + (mp->mnt_kern_flag & MNTK_WANTRDWR) == 0) != 0) + return (EPERM); if (fs->s_rd_only && (mp->mnt_kern_flag & MNTK_WANTRDWR)) { /* * If upgrade to read-write by non-root, then verify * that user has necessary permissions on the device. */ if (p->p_ucred->cr_uid != 0) { - devvp = ump->um_devvp; vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p); if ((error = VOP_ACCESS(devvp, VREAD | VWRITE, p->p_ucred, p)) != 0) { |