android_kernel_oneplus_msm8998/fs/ext4
Lukas Czerner 629433b4f9 ext4: fix bitmap position validation
commit 22be37acce25d66ecf6403fc8f44df9c5ded2372 upstream.

Currently in ext4_valid_block_bitmap() we expect the bitmap to be
positioned anywhere between 0 and s_blocksize clusters, but that's
wrong because the bitmap can be placed anywhere in the block group. This
causes false positives when validating bitmaps on perfectly valid file
system layouts. Fix it by checking whether the bitmap is within the group
boundary.

The problem can be reproduced using the following

mkfs -t ext3 -E stride=256 /dev/vdb1
mount /dev/vdb1 /mnt/test
cd /mnt/test
wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.16.3.tar.xz
tar xf linux-4.16.3.tar.xz

This will result in the warnings in the logs

EXT4-fs error (device vdb1): ext4_validate_block_bitmap:399: comm tar: bg 84: block 2774529: invalid block bitmap

[ Changed slightly for clarity and to not drop a overflow test -- TYT ]

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reported-by: Ilya Dryomov <idryomov@gmail.com>
Fixes: 7dac4a1726a9 ("ext4: add validity checks for bitmap block numbers")
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-02 07:53:38 -07:00
..
acl.c ext4: Don't clear SGID when inheriting ACLs 2017-10-12 11:27:35 +02:00
acl.h
balloc.c ext4: fix bitmap position validation 2018-05-02 07:53:38 -07:00
bitmap.c
block_validity.c
crypto.c ext4 crypto: don't let data integrity writebacks fail with ENOMEM 2017-05-25 14:30:11 +02:00
crypto_fname.c fscrypt: avoid collisions when presenting long encrypted filenames 2017-05-25 14:30:11 +02:00
crypto_key.c fscrypt: lock mutex before checking for bounce page pool 2017-11-30 08:37:25 +00:00
crypto_policy.c fscrypt: fix context consistency check when key(s) unavailable 2017-05-25 14:30:11 +02:00
dir.c ext4 crypto: revalidate dentry after adding or removing the key 2017-05-08 07:46:02 +02:00
ext4.h ext4 crypto: don't let data integrity writebacks fail with ENOMEM 2017-05-25 14:30:11 +02:00
ext4_crypto.h fscrypt: remove broken support for detecting keyring key revocation 2017-03-31 09:49:54 +02:00
ext4_extents.h
ext4_jbd2.c
ext4_jbd2.h ext4: do not perform data journaling when data is encrypted 2017-01-06 11:16:13 +01:00
extents.c ext4: prevent right-shifting extents beyond EXT_MAX_BLOCKS 2018-05-02 07:53:38 -07:00
extents_status.c
extents_status.h
file.c ext4: fix off-by-one on max nr_pages in ext4_find_unwritten_pgoff() 2018-04-13 19:50:11 +02:00
fsync.c
hash.c
ialloc.c ext4: add validity checks for bitmap block numbers 2018-05-02 07:53:38 -07:00
indirect.c
inline.c ext4: fix deadlock between inline_data and ext4_expand_extra_isize_ea() 2018-04-24 09:32:10 +02:00
inode.c ext4: bugfix for mmaped pages in mpage_release_unused_pages() 2018-04-24 09:32:11 +02:00
ioctl.c ext4: require encryption feature for EXT4_IOC_SET_ENCRYPTION_POLICY 2017-05-08 07:46:02 +02:00
Kconfig
Makefile
mballoc.c ext4: handle the rest of ext4_mb_load_buddy() ENOMEM errors 2018-04-13 19:50:09 +02:00
mballoc.h
migrate.c
mmp.c
move_extent.c fs: add i_blocksize() 2017-06-14 13:16:24 +02:00
namei.c don't put symlink bodies in pagecache into highmem 2018-02-16 20:09:38 +01:00
page-io.c ext4 crypto: fix some error handling 2017-05-25 14:30:11 +02:00
readpage.c ext4 crypto: don't let data integrity writebacks fail with ENOMEM 2017-05-25 14:30:11 +02:00
resize.c ext4: fix overflow caused by missing cast in ext4_resize_fs() 2017-08-11 09:08:48 -07:00
super.c ext4: don't allow r/w mounts if metadata blocks overlap the superblock 2018-04-24 09:32:09 +02:00
symlink.c don't put symlink bodies in pagecache into highmem 2018-02-16 20:09:38 +01:00
sysfs.c ext4: check return value of kstrtoull correctly in reserved_clusters_store 2017-07-15 11:57:50 +02:00
truncate.h ext4: fix races between page faults and hole punching 2016-05-04 14:48:53 -07:00
xattr.c ext4: fix deadlock between inline_data and ext4_expand_extra_isize_ea() 2018-04-24 09:32:10 +02:00
xattr.h ext4: fix deadlock between inline_data and ext4_expand_extra_isize_ea() 2018-04-24 09:32:10 +02:00
xattr_security.c
xattr_trusted.c
xattr_user.c