diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-06-17 22:59:28 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-06-17 22:59:28 +0200 |
commit | 9b9410766f5422d1e736783dc0c3a053eefedac4 (patch) | |
tree | bd397aa6fdecfd0713b725f9728d42e8261093d4 /drivers/staging/erofs/super.c | |
parent | d7a5417b89470d353118a451630ed71f119f58b8 (diff) | |
parent | 5efe5137f05bbb4688890620934538c005e7d1d6 (diff) | |
download | linux-9b9410766f5422d1e736783dc0c3a053eefedac4.tar.bz2 |
Merge branch 'erofs_fix' into staging-linus
A branch is needed here to get the fix into staging-next as well.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/erofs/super.c')
-rw-r--r-- | drivers/staging/erofs/super.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/staging/erofs/super.c b/drivers/staging/erofs/super.c index f580d4ef77a1..cadbcc11702a 100644 --- a/drivers/staging/erofs/super.c +++ b/drivers/staging/erofs/super.c @@ -71,6 +71,22 @@ static void free_inode(struct inode *inode) kmem_cache_free(erofs_inode_cachep, vi); } +static bool check_layout_compatibility(struct super_block *sb, + struct erofs_super_block *layout) +{ + const unsigned int requirements = le32_to_cpu(layout->requirements); + + EROFS_SB(sb)->requirements = requirements; + + /* check if current kernel meets all mandatory requirements */ + if (requirements & (~EROFS_ALL_REQUIREMENTS)) { + errln("unidentified requirements %x, please upgrade kernel version", + requirements & ~EROFS_ALL_REQUIREMENTS); + return false; + } + return true; +} + static int superblock_read(struct super_block *sb) { struct erofs_sb_info *sbi; @@ -104,6 +120,9 @@ static int superblock_read(struct super_block *sb) goto out; } + if (!check_layout_compatibility(sb, layout)) + goto out; + sbi->blocks = le32_to_cpu(layout->blocks); sbi->meta_blkaddr = le32_to_cpu(layout->meta_blkaddr); #ifdef CONFIG_EROFS_FS_XATTR |