|
@@ -466,6 +466,16 @@ static int validate_sb(struct ubifs_info *c, struct ubifs_sb_node *sup)
|
|
|
goto failed;
|
|
|
}
|
|
|
|
|
|
+ if (!c->double_hash && c->fmt_version >= 5) {
|
|
|
+ err = 16;
|
|
|
+ goto failed;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (c->encrypted && c->fmt_version < 5) {
|
|
|
+ err = 17;
|
|
|
+ goto failed;
|
|
|
+ }
|
|
|
+
|
|
|
return 0;
|
|
|
|
|
|
failed:
|
|
@@ -624,6 +634,13 @@ int ubifs_read_superblock(struct ubifs_info *c)
|
|
|
c->double_hash = !!(sup_flags & UBIFS_FLG_DOUBLE_HASH);
|
|
|
c->encrypted = !!(sup_flags & UBIFS_FLG_ENCRYPTION);
|
|
|
|
|
|
+ if ((sup_flags & ~UBIFS_FLG_MASK) != 0) {
|
|
|
+ ubifs_err(c, "Unknown feature flags found: %#x",
|
|
|
+ sup_flags & ~UBIFS_FLG_MASK);
|
|
|
+ err = -EINVAL;
|
|
|
+ goto out;
|
|
|
+ }
|
|
|
+
|
|
|
#ifndef CONFIG_UBIFS_FS_ENCRYPTION
|
|
|
if (c->encrypted) {
|
|
|
ubifs_err(c, "file system contains encrypted files but UBIFS"
|