diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-06-21 10:20:19 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-06-21 10:20:19 -0700 |
commit | db54615e21419c3cb4d699a0b0aa16cc44d0e9da (patch) | |
tree | 9ee9d11acbe1325e3d8cad45843b1514d612da1d /drivers/staging/erofs/super.c | |
parent | b7b8a44f3abab51cc2772c5ced2fe2f51a1ad2b8 (diff) | |
parent | 9b9410766f5422d1e736783dc0c3a053eefedac4 (diff) | |
download | linux-db54615e21419c3cb4d699a0b0aa16cc44d0e9da.tar.bz2 |
Merge tag 'staging-5.2-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
Pull staging/IIO/counter fixes from Greg KH:
"Here are some small driver bugfixes for some staging/iio/counter
drivers.
Staging and IIO have been lumped together for a while, as those
subsystems cross the areas a log, and counter is used by IIO, so
that's why they are all in one pull request here.
These are small fixes for reported issues in some iio drivers, the
erofs filesystem, and a build issue for counter code.
All have been in linux-next with no reported issues"
* tag 'staging-5.2-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
staging: erofs: add requirements field in superblock
counter/ftm-quaddec: Add missing dependencies in Kconfig
staging: iio: adt7316: Fix build errors when GPIOLIB is not set
iio: temperature: mlx90632 Relax the compatibility check
iio: imu: st_lsm6dsx: fix PM support for st_lsm6dsx i2c controller
staging:iio:ad7150: fix threshold mode config bit
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 |