android_kernel_samsung_msm8226/fs
Lukas Czerner e80ad51671 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 ]

Change-Id: I273c2632a22d946ad88bee30f97eec255a885fa1
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")
[bwh: Backported to 3.2: adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>
2020-01-06 08:40:27 +01:00
..
9p BACKPORT: posix_acl: Clear SGID bit when setting file permissions 2019-08-06 12:23:27 +02:00
adfs fs: Limit sys_mount to only request filesystem modules. 2019-08-06 10:44:59 +02:00
affs fs: Limit sys_mount to only request filesystem modules. 2019-08-06 10:44:59 +02:00
afs fs: Limit sys_mount to only request filesystem modules. 2019-08-06 10:44:59 +02:00
autofs4 fs: Limit sys_mount to only request filesystem modules. 2019-08-06 10:44:59 +02:00
befs fs: Limit sys_mount to only request filesystem modules. 2019-08-06 10:44:59 +02:00
bfs fs: Limit sys_mount to only request filesystem modules. 2019-08-06 10:44:59 +02:00
btrfs BACKPORT: posix_acl: Clear SGID bit when setting file permissions 2019-08-06 12:23:27 +02:00
cachefiles Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
ceph fs: Limit sys_mount to only request filesystem modules. 2019-08-06 10:44:59 +02:00
cifs Merge remote-tracking branch 'google-common/deprecated/android-3.4' into lineage-16.0 2019-08-06 11:41:21 +02:00
coda fs: Limit sys_mount to only request filesystem modules. 2019-08-06 10:44:59 +02:00
configfs fs: Limit sys_mount to only request filesystem modules. 2019-08-06 10:44:59 +02:00
cramfs fs: Limit sys_mount to only request filesystem modules. 2019-08-06 10:44:59 +02:00
crypto fscrypt: remove broken support for detecting keyring key revocation 2019-08-06 12:26:38 +02:00
debugfs fs: Limit sys_mount to only request filesystem modules. 2019-08-06 10:44:59 +02:00
devpts fs: Limit sys_mount to only request filesystem modules. 2019-08-06 10:44:59 +02:00
dlm
ecryptfs ecryptfs: don't allow mmap when the lower fs doesn't support it 2019-08-06 11:48:23 +02:00
efs fs: Limit sys_mount to only request filesystem modules. 2019-08-06 10:44:59 +02:00
exfat fs: exfat: Allow disabling exfat 2020-01-06 08:40:23 +01:00
exofs fs: Limit sys_mount to only request filesystem modules. 2019-08-06 10:44:59 +02:00
exportfs Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
ext2 BACKPORT: posix_acl: Clear SGID bit when setting file permissions 2019-08-06 12:23:27 +02:00
ext3 BACKPORT: posix_acl: Clear SGID bit when setting file permissions 2019-08-06 12:23:27 +02:00
ext4 ext4: fix bitmap position validation 2020-01-06 08:40:27 +01:00
f2fs BACKPORT: f2fs: sanity check checkpoint segno and blkoff 2019-08-06 12:31:21 +02:00
fat fs: Limit sys_mount to only request filesystem modules. 2019-08-06 10:44:59 +02:00
freevxfs fs: Limit sys_mount to only request filesystem modules. 2019-08-06 10:44:59 +02:00
fscache Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
fuse ANDROID: fuse: Add null terminator to path in canonical path to avoid issue 2020-01-06 08:40:25 +01:00
gfs2 BACKPORT: posix_acl: Clear SGID bit when setting file permissions 2019-08-06 12:23:27 +02:00
hfs fs: Limit sys_mount to only request filesystem modules. 2019-08-06 10:44:59 +02:00
hfsplus fs: Limit sys_mount to only request filesystem modules. 2019-08-06 10:44:59 +02:00
hostfs Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
hpfs Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
hppfs fs: Limit sys_mount to only request filesystem modules. 2019-08-06 10:44:59 +02:00
hugetlbfs mm: larger stack guard gap, between vmas 2019-08-06 12:26:29 +02:00
isofs fs: Limit sys_mount to only request filesystem modules. 2019-08-06 10:44:59 +02:00
jbd Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
jbd2 Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
jffs2 BACKPORT: posix_acl: Clear SGID bit when setting file permissions 2019-08-06 12:23:27 +02:00
jfs BACKPORT: posix_acl: Clear SGID bit when setting file permissions 2019-08-06 12:23:27 +02:00
lockd Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
logfs fs: Limit sys_mount to only request filesystem modules. 2019-08-06 10:44:59 +02:00
minix fs: Limit sys_mount to only request filesystem modules. 2019-08-06 10:44:59 +02:00
ncpfs fs: Limit sys_mount to only request filesystem modules. 2019-08-06 10:44:59 +02:00
nfs Merge remote-tracking branch 'google-common/deprecated/android-3.4' into lineage-16.0 2019-08-06 11:41:21 +02:00
nfs_common
nfsd fs: Limit sys_mount to only request filesystem modules. 2019-08-06 10:44:59 +02:00
nilfs2 fs: Limit sys_mount to only request filesystem modules. 2019-08-06 10:44:59 +02:00
nls
notify vfs: Add permission2 for filesystems with per mount permissions 2019-08-06 10:44:34 +02:00
ntfs fs: Limit sys_mount to only request filesystem modules. 2019-08-06 10:44:59 +02:00
ocfs2 BACKPORT: posix_acl: Clear SGID bit when setting file permissions 2019-08-06 12:23:27 +02:00
omfs fs: Limit sys_mount to only request filesystem modules. 2019-08-06 10:44:59 +02:00
openpromfs fs: Limit sys_mount to only request filesystem modules. 2019-08-06 10:44:59 +02:00
proc fs: proc: Remove Samsung changes to commandline 2020-01-06 08:40:22 +01:00
pstore Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
qnx4 fs: Limit sys_mount to only request filesystem modules. 2019-08-06 10:44:59 +02:00
qnx6 fs: Limit sys_mount to only request filesystem modules. 2019-08-06 10:44:59 +02:00
quota Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
ramfs Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
reiserfs BACKPORT: posix_acl: Clear SGID bit when setting file permissions 2019-08-06 12:23:27 +02:00
romfs fs: Limit sys_mount to only request filesystem modules. 2019-08-06 10:44:59 +02:00
scfs misc: Import SM-G900H kernel source code 2019-08-02 15:14:10 +02:00
sdcardfs ANDROID: sdcardfs: fix potential crash when reserved_mb is not zero 2020-01-06 08:40:25 +01:00
sdfat fs: sdfat: Add MODULE_ALIAS_FS for supported filesystems 2020-01-06 08:40:24 +01:00
squashfs
sysfs Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
sysv fs: Limit sys_mount to only request filesystem modules. 2019-08-06 10:44:59 +02:00
ubifs fs: Limit sys_mount to only request filesystem modules. 2019-08-06 10:44:59 +02:00
udf Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
ufs fs: Limit sys_mount to only request filesystem modules. 2019-08-06 10:44:59 +02:00
xfs BACKPORT: posix_acl: Clear SGID bit when setting file permissions 2019-08-06 12:23:27 +02:00
yaffs2
aio.c BACKPORT: aio: mark AIO pseudo-fs noexec 2019-08-06 11:48:19 +02:00
anon_inodes.c
attr.c vfs: Add setattr2 for filesystems with per mount permissions 2019-08-06 10:44:35 +02:00
bad_inode.c
binfmt_aout.c
binfmt_elf.c Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
binfmt_elf_fdpic.c
binfmt_em86.c Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
binfmt_flat.c
binfmt_misc.c fs: Limit sys_mount to only request filesystem modules. 2019-08-06 10:44:59 +02:00
binfmt_script.c Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
binfmt_som.c
bio-integrity.c
bio.c Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
block_dev.c Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
buffer.c Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
char_dev.c
compat.c Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
compat_binfmt_elf.c
compat_ioctl.c Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
dcache.c constify d_lookup() arguments 2019-08-06 10:44:47 +02:00
dcookies.c
direct-io.c Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
drop_caches.c misc: Import SM-G900H kernel source code 2019-08-02 15:14:10 +02:00
eventfd.c
eventpoll.c PM: Rename CAP_EPOLLWAKEUP to CAP_BLOCK_SUSPEND 2019-08-08 15:09:54 +02:00
exec.c fs/exec.c: account for argv/envp pointers 2019-08-06 12:26:30 +02:00
fcntl.c misc: Import SM-G900H kernel source code 2019-08-02 15:14:10 +02:00
fhandle.c vfs: read file_handle only once in handle_to_path 2015-07-21 01:37:10 -07:00
fifo.c Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
file.c Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
file_table.c Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
filesystems.c fs: Limit sys_mount to only request filesystem modules. 2019-08-06 10:44:59 +02:00
fs-writeback.c Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
fs_struct.c sdcardfs: override umask on mkdir and create 2019-08-06 10:44:26 +02:00
generic_acl.c BACKPORT: posix_acl: Clear SGID bit when setting file permissions 2019-08-06 12:23:27 +02:00
inode.c fs: introduce inode operation ->update_time 2019-08-06 10:44:13 +02:00
internal.h vfs: Allow filesystems to access their private mount data 2019-08-06 10:44:34 +02:00
ioctl.c
ioprio.c Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
Kconfig fs: Add sdfat 2020-01-06 08:40:22 +01:00
Kconfig.binfmt
libfs.c Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
locks.c Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
Makefile fs: Add sdfat 2020-01-06 08:40:22 +01:00
mbcache.c
mount.h Merge remote-tracking branch 'google-common/deprecated/android-3.4' into lineage-16.0 2019-08-06 11:41:21 +02:00
mpage.c
namei.c ANDROID: vfs: Missed updating truncate to truncate2 2019-08-06 10:44:40 +02:00
namespace.c ANDROID: mnt: Fix freeing of mount data 2019-08-08 12:19:53 +02:00
no-block.c
open.c splice: introduce FMODE_SPLICE_READ and FMODE_SPLICE_WRITE 2019-08-06 12:24:24 +02:00
pipe.c fs: introduce inode operation ->update_time 2019-08-06 10:44:13 +02:00
pnode.c ANDROID: mnt: Fix next_descendent 2019-08-06 10:45:24 +02:00
pnode.h Merge remote-tracking branch 'google-common/deprecated/android-3.4' into lineage-16.0 2019-08-06 11:41:21 +02:00
posix_acl.c BACKPORT: posix_acl: Clear SGID bit when setting file permissions 2019-08-06 12:23:27 +02:00
proc_namespace.c vfs: Allow filesystems to access their private mount data 2019-08-06 10:44:34 +02:00
read_write.c
read_write.h
readdir.c kernel: Only expose su when daemon is running 2019-08-05 09:12:33 +02:00
select.c Merge remote-tracking branch 'google-common/deprecated/android-3.4' into lineage-16.0 2019-08-06 11:41:21 +02:00
seq_file.c misc: Import SM-G900H kernel source code 2019-08-02 15:14:10 +02:00
signalfd.c
splice.c splice: introduce FMODE_SPLICE_READ and FMODE_SPLICE_WRITE 2019-08-06 12:24:24 +02:00
stack.c
stat.c Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
statfs.c Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
super.c vfs: Allow filesystems to access their private mount data 2019-08-06 10:44:34 +02:00
sync.c
timerfd.c timerfd: add alarm timers 2019-08-06 12:31:34 +02:00
utimes.c vfs: Add setattr2 for filesystems with per mount permissions 2019-08-06 10:44:35 +02:00
xattr.c ANDROID: xattr: Pass EOPNOTSUPP to permission2 2020-01-06 08:40:22 +01:00
xattr_acl.c