android_kernel_samsung_msm8976/fs/ext4
Vegard Nossum d5edde23cc ext4: verify extent header depth
commit 7bc9491645118c9461bd21099c31755ff6783593 upstream.

Although the extent tree depth of 5 should enough be for the worst
case of 2*32 extents of length 1, the extent tree code does not
currently to merge nodes which are less than half-full with a sibling
node, or to shrink the tree depth if possible.  So it's possible, at
least in theory, for the tree depth to be greater than 5.  However,
even in the worst case, a tree depth of 32 is highly unlikely, and if
the file system is maliciously corrupted, an insanely large eh_depth
can cause memory allocation failures that will trigger kernel warnings
(here, eh_depth = 65280):

    JBD2: ext4.exe wants too many credits credits:195849 rsv_credits:0 max:256
    ------------[ cut here ]------------
    WARNING: CPU: 0 PID: 50 at fs/jbd2/transaction.c:293 start_this_handle+0x569/0x580
    CPU: 0 PID: 50 Comm: ext4.exe Not tainted 4.7.0-rc5+ #508
    Stack:
     604a8947 625badd8 0002fd09 00000000
     60078643 00000000 62623910 601bf9bc
     62623970 6002fc84 626239b0 900000125
    Call Trace:
     [<6001c2dc>] show_stack+0xdc/0x1a0
     [<601bf9bc>] dump_stack+0x2a/0x2e
     [<6002fc84>] __warn+0x114/0x140
     [<6002fdff>] warn_slowpath_null+0x1f/0x30
     [<60165829>] start_this_handle+0x569/0x580
     [<60165d4e>] jbd2__journal_start+0x11e/0x220
     [<60146690>] __ext4_journal_start_sb+0x60/0xa0
     [<60120a81>] ext4_truncate+0x131/0x3a0
     [<60123677>] ext4_setattr+0x757/0x840
     [<600d5d0f>] notify_change+0x16f/0x2a0
     [<600b2b16>] do_truncate+0x76/0xc0
     [<600c3e56>] path_openat+0x806/0x1300
     [<600c55c9>] do_filp_open+0x89/0xf0
     [<600b4074>] do_sys_open+0x134/0x1e0
     [<600b4140>] SyS_open+0x20/0x30
     [<6001ea68>] handle_syscall+0x88/0x90
     [<600295fd>] userspace+0x3fd/0x500
     [<6001ac55>] fork_handler+0x85/0x90

    ---[ end trace 08b0b88b6387a244 ]---

[ Commit message modified and the extent tree depath check changed
from 5 to 32 -- tytso ]

Cc: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Willy Tarreau <w@1wt.eu>
2019-07-27 21:41:50 +02:00
..
acl.c posix_acl: Clear SGID bit when setting file permissions 2017-04-28 00:00:11 -07:00
acl.h
balloc.c Import latest Samsung release 2017-04-18 03:43:52 +02:00
bitmap.c ext4: Checksum the block bitmap properly with bigalloc enabled 2012-10-22 00:34:32 -04:00
block_validity.c Import latest Samsung release 2017-04-18 03:43:52 +02:00
dir.c Import latest Samsung release 2017-04-18 03:43:52 +02:00
ext4.h fs: Remove Samsung implementation of sdcardfs 2018-02-06 13:12:17 +01:00
ext4_extents.h ext4: mext_insert_extents should update extent block checksum 2013-04-19 14:04:12 -04:00
ext4_jbd2.c Import latest Samsung release 2017-04-18 03:43:52 +02:00
ext4_jbd2.h ext4: improve credit estimate for EXT4_SINGLEDATA_TRANS_BLOCKS 2013-04-09 12:39:26 -04:00
extents.c ext4: verify extent header depth 2019-07-27 21:41:50 +02:00
extents_status.c ext4: fix data corruption caused by unwritten and delayed extents 2015-05-13 05:15:42 -07:00
extents_status.h ext4: fix fio regression 2013-05-03 02:15:52 -04:00
file.c ext4: prevent bugon on race between write/fcntl 2015-02-11 14:48:17 +08:00
fsync.c ext4/jbd2: don't wait (forever) for stale tid caused by wraparound 2013-04-03 22:02:52 -04:00
hash.c ext4: reduce one "if" comparison in ext4_dirhash() 2013-02-01 22:33:21 -05:00
ialloc.c ext4: fix hang when processing corrupted orphaned inode list 2019-07-27 21:41:49 +02:00
indirect.c ext4: don't retry file block mapping on bigalloc fs with non-extent file 2015-08-03 09:29:43 -07:00
inline.c fs: Remove Samsung implementation of sdcardfs 2018-02-06 13:12:17 +01:00
inode.c Merge tag 'LA.BR.1.3.6-05410-8976.0' of https://source.codeaurora.org/quic/la/kernel/msm-3.10 into HEAD 2018-02-06 13:11:45 +01:00
ioctl.c Import latest Samsung release 2017-04-18 03:43:52 +02:00
Kconfig ext4: fix Kconfig documentation for CONFIG_EXT4_DEBUG 2013-04-21 20:32:03 -04:00
Makefile Import latest Samsung release 2017-04-18 03:43:52 +02:00
mballoc.c ext4: silence UBSAN in ext4_mb_init() 2019-07-27 21:41:50 +02:00
mballoc.h ext4: use module parameters instead of debugfs for mballoc_debug 2013-02-09 16:28:20 -05:00
migrate.c ext4: correctly migrate a file with a hole at the beginning 2015-08-03 09:29:43 -07:00
mmp.c ext4: mark all metadata I/O with REQ_META 2013-04-20 15:46:17 -04:00
move_extent.c ext4: add lockdep annotations for i_data_sem 2016-06-07 10:42:50 +02:00
namei.c ext[34]: fix double put in tmpfile 2018-12-03 11:52:41 +01:00
page-io.c ext4: fix zeroing of page during writeback 2014-06-30 20:09:42 -07:00
resize.c This is the 3.10.98 stable release 2017-04-18 17:17:24 +02:00
super.c ext4: fix fencepost in s_first_meta_bg validation 2017-06-22 10:19:05 +00:00
symlink.c ext4: Remove CONFIG_EXT4_FS_XATTR 2012-12-10 16:30:43 -05:00
truncate.h
xattr.c ext4: check EA value offset when loading 2014-11-14 08:47:57 -08:00
xattr.h ext4: reserve xattr index for Rich ACL support 2013-04-18 14:53:15 -04:00
xattr_security.c Merge branch 'for_linus' into for_linus_merged 2012-01-10 11:54:07 -05:00
xattr_trusted.c ext2/3/4: delete unneeded includes of module.h 2012-01-09 13:52:10 +01:00
xattr_user.c ext2/3/4: delete unneeded includes of module.h 2012-01-09 13:52:10 +01:00