Import commits by Kaho Ng <ngkaho1234@gmail.com> from upstream:
- b7657e5 Ext3Fsd: Introduce VCB_RO_COMPAT_READ_ONLY flag for struct VCB
- e7c1142 Ext3Fsd: EXT4_FEATURE_INCOMPAT_64BIT is not supported
- 785943f Ext3Fsd: fix issue #6

Refuse mounting filesystems with incompatible flags. This avoids corrupting 64bits filesystems.

Patch by Lubomir Rintel

CORE-13589

svn path=/trunk/; revision=75422
This commit is contained in:
Pierre Schweitzer 2017-07-27 10:22:57 +00:00
parent 4f5478d56a
commit 5c2272b886
4 changed files with 15 additions and 9 deletions

View file

@ -789,6 +789,7 @@ typedef struct _EXT2_VCB {
#define VCB_DEVICE_REMOVED 0x00008000
#define VCB_JOURNAL_RECOVER 0x00080000
#define VCB_ARRIVAL_NOTIFIED 0x00800000
#define VCB_RO_COMPAT_READ_ONLY 0x01000000
#define VCB_READ_ONLY 0x08000000
#define VCB_WRITE_PROTECTED 0x10000000
#define VCB_FLOPPY_DISK 0x20000000
@ -800,6 +801,7 @@ typedef struct _EXT2_VCB {
#define IsMounted(Vcb) (IsFlagOn((Vcb)->Flags, VCB_MOUNTED))
#define IsDispending(Vcb) (IsFlagOn((Vcb)->Flags, VCB_DISMOUNT_PENDING))
#define IsVcbReadOnly(Vcb) (IsFlagOn((Vcb)->Flags, VCB_READ_ONLY) || \
IsFlagOn((Vcb)->Flags, VCB_RO_COMPAT_READ_ONLY) || \
IsFlagOn((Vcb)->Flags, VCB_WRITE_PROTECTED))

View file

@ -720,7 +720,6 @@ static inline int ext3_valid_inum(struct super_block *sb, unsigned long ino)
EXT4_FEATURE_INCOMPAT_RECOVER| \
EXT4_FEATURE_INCOMPAT_META_BG| \
EXT4_FEATURE_INCOMPAT_EXTENTS| \
EXT4_FEATURE_INCOMPAT_64BIT| \
EXT4_FEATURE_INCOMPAT_FLEX_BG)
#define EXT4_FEATURE_RO_COMPAT_SUPP ( \
EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER| \

View file

@ -2318,17 +2318,22 @@ Ext2InitializeVcb( IN PEXT2_IRP_CONTEXT IrpContext,
_SEH2_LEAVE;
}
/* checking in/compat features */
if (IsFlagOn(sb->s_feature_compat, EXT3_FEATURE_COMPAT_HAS_JOURNAL)) {
Vcb->IsExt3fs = TRUE;
}
/* don't mount any volumes with external journal devices */
if (IsFlagOn(sb->s_feature_incompat, EXT3_FEATURE_INCOMPAT_JOURNAL_DEV)) {
/* Reject mounting volume if we encounter unsupported incompat features */
if (FlagOn(sb->s_feature_incompat, ~EXT4_FEATURE_INCOMPAT_SUPP)) {
Status = STATUS_UNRECOGNIZED_VOLUME;
_SEH2_LEAVE;
}
/* Mount the volume RO if we encounter unsupported ro_compat features */
if (FlagOn(sb->s_feature_ro_compat, ~EXT4_FEATURE_RO_COMPAT_SUPP)) {
SetLongFlag(Vcb->Flags, VCB_RO_COMPAT_READ_ONLY);
}
/* Recognize the filesystem as Ext3fs if it supports journalling */
if (IsFlagOn(sb->s_feature_compat, EXT4_FEATURE_COMPAT_HAS_JOURNAL)) {
Vcb->IsExt3fs = TRUE;
}
/* check block size */
Vcb->BlockSize = (EXT2_MIN_BLOCK_SIZE << sb->s_log_block_size);
/* we cannot handle volume with block size bigger than 64k */

View file

@ -9,7 +9,7 @@ reactos/sdk/lib/fslib/btrfslib # Synced to 0.8
The following FSD are shared with: http://www.ext2fsd.com/
reactos/drivers/filesystems/ext2 # Synced to 0.68
reactos/drivers/filesystems/ext2 # Synced to 0.68, with b7657e5, e7c1142, 785943f
The following FSD are shared with: http://www.acc.umu.se/~bosse/