1
0
Fork 0
alistair23-linux/fs/f2fs
Martin Blumenstingl 88960068f2 f2fs: fix validation of the block count in sanity_check_raw_super
Treat "block_count" from struct f2fs_super_block as 64-bit little endian
value in sanity_check_raw_super() because struct f2fs_super_block
declares "block_count" as "__le64".

This fixes a bug where the superblock validation fails on big endian
devices with the following error:
  F2FS-fs (sda1): Wrong segment_count / block_count (61439 > 0)
  F2FS-fs (sda1): Can't find valid F2FS filesystem in 1th superblock
  F2FS-fs (sda1): Wrong segment_count / block_count (61439 > 0)
  F2FS-fs (sda1): Can't find valid F2FS filesystem in 2th superblock
As result of this the partition cannot be mounted.

With this patch applied the superblock validation works fine and the
partition can be mounted again:
  F2FS-fs (sda1): Mounted with checkpoint version = 7c84

My little endian x86-64 hardware was able to mount the partition without
this fix.
To confirm that mounting f2fs filesystems works on big endian machines
again I tested this on a 32-bit MIPS big endian (lantiq) device.

Fixes: 0cfe75c5b0 ("f2fs: enhance sanity_check_raw_super() to avoid potential overflows")
Cc: stable@vger.kernel.org
Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
2018-12-26 15:16:55 -08:00
..
Kconfig fs/*/Kconfig: drop links to 404-compliant http://acl.bestbits.at 2018-01-01 12:45:37 -07:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
acl.c f2fs: use kvmalloc, if kmalloc is failed 2018-12-26 15:16:53 -08:00
acl.h f2fs: add SPDX license identifiers 2018-09-12 13:07:10 -07:00
checkpoint.c f2fs: clean up checkpoint flow 2018-12-26 15:16:54 -08:00
data.c f2fs: use kvmalloc, if kmalloc is failed 2018-12-26 15:16:53 -08:00
debug.c f2fs: correct wrong spelling, issing_* 2018-12-26 15:16:54 -08:00
dir.c f2fs: check memory boundary by insane namelen 2018-11-26 15:53:57 -08:00
extent_cache.c f2fs: use rb_*_cached friends 2018-10-16 09:36:59 -07:00
f2fs.h f2fs: clean up structure extent_node 2018-12-26 15:16:55 -08:00
file.c f2fs: fix to dirty inode synchronously 2018-12-26 15:16:55 -08:00
gc.c f2fs: use kvmalloc, if kmalloc is failed 2018-12-26 15:16:53 -08:00
gc.h f2fs: add SPDX license identifiers 2018-09-12 13:07:10 -07:00
hash.c f2fs: add SPDX license identifiers 2018-09-12 13:07:10 -07:00
inline.c f2fs: use kvmalloc, if kmalloc is failed 2018-12-26 15:16:53 -08:00
inode.c f2fs: clean up f2fs_sb_has_##feature_name 2018-11-26 15:53:55 -08:00
namei.c f2fs: use kvmalloc, if kmalloc is failed 2018-12-26 15:16:53 -08:00
node.c f2fs: use kvmalloc, if kmalloc is failed 2018-12-26 15:16:53 -08:00
node.h f2fs: add SPDX license identifiers 2018-09-12 13:07:10 -07:00
recovery.c f2fs: clean up f2fs_sb_has_##feature_name 2018-11-26 15:53:55 -08:00
segment.c f2fs: fix block address for __check_sit_bitmap 2018-12-26 15:16:55 -08:00
segment.h f2fs: introduce __is_large_section() for cleanup 2018-11-26 15:53:55 -08:00
shrinker.c f2fs: fix sbi->extent_list corruption issue 2018-12-26 15:16:54 -08:00
super.c f2fs: fix validation of the block count in sanity_check_raw_super 2018-12-26 15:16:55 -08:00
sysfs.c f2fs: export migration_granularity sysfs entry 2018-11-26 15:53:56 -08:00
trace.c f2fs: add SPDX license identifiers 2018-09-12 13:07:10 -07:00
trace.h f2fs: add SPDX license identifiers 2018-09-12 13:07:10 -07:00
xattr.c f2fs: add SPDX license identifiers 2018-09-12 13:07:10 -07:00
xattr.h f2fs: add SPDX license identifiers 2018-09-12 13:07:10 -07:00