diff options
author | Richard Weinberger <richard@nod.at> | 2016-10-19 23:46:39 +0200 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2016-12-12 23:07:38 +0100 |
commit | fc4b891bbefa73b496bb44b076bb5274b6bfba68 (patch) | |
tree | 9ba963d538c16866a148dea20c426b89b815d4c6 /fs/ubifs/sb.c | |
parent | e021986ee4119e487febb9a5f077ec77dff85865 (diff) | |
download | linux-fc4b891bbefa73b496bb44b076bb5274b6bfba68.tar.gz linux-fc4b891bbefa73b496bb44b076bb5274b6bfba68.tar.bz2 linux-fc4b891bbefa73b496bb44b076bb5274b6bfba68.zip |
ubifs: Raise write version to 5
Starting with version 5 the following properties change:
- UBIFS_FLG_DOUBLE_HASH is mandatory
- UBIFS_FLG_ENCRYPTION is optional but depdens on UBIFS_FLG_DOUBLE_HASH
- Filesystems with unknown super block flags will be rejected, this
allows us in future to add new features without raising the UBIFS
write version.
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'fs/ubifs/sb.c')
-rw-r--r-- | fs/ubifs/sb.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c index 54cef70ea16f..7f1ead29e727 100644 --- a/fs/ubifs/sb.c +++ b/fs/ubifs/sb.c @@ -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" |