android_kernel_samsung_a7y1.../fs/ext4
Dan Carpenter 6fef7d52e3 ext4: potential crash on allocation error in ext4_alloc_flex_bg_array()
commit 37b0b6b8b99c0e1c1f11abbe7cf49b6d03795b3f upstream.

If sbi->s_flex_groups_allocated is zero and the first allocation fails
then this code will crash.  The problem is that "i--" will set "i" to
-1 but when we compare "i >= sbi->s_flex_groups_allocated" then the -1
is type promoted to unsigned and becomes UINT_MAX.  Since UINT_MAX
is more than zero, the condition is true so we call kvfree(new_groups[-1]).
The loop will carry on freeing invalid memory until it crashes.

Fixes: 7c990728b99e ("ext4: fix potential race between s_flex_groups online resizing and access")
Reviewed-by: Suraj Jitindar Singh <surajjs@amazon.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: stable@kernel.org
Link: https://lore.kernel.org/r/20200228092142.7irbc44yaz3by7nb@kili.mountain
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-07 14:04:41 +02:00
..
sdp A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
acl.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
acl.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
balloc.c ext4: fix potential race between online resizing and write operations 2020-04-07 14:04:09 +02:00
bitmap.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
block_validity.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
crypto_fname.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
crypto_key.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
crypto_policy.c fscrypt: don't set policy for a dead directory 2020-04-06 19:29:02 +02:00
crypto.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
dir.c ext4: fix checksum errors with indexed dirs 2020-04-07 13:55:12 +02:00
ext4_crypto.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ext4_extents.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ext4_jbd2.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ext4_jbd2.h ext4: fix NULL pointer dereference while journal is aborted 2020-04-06 10:58:15 +02:00
ext4.h ext4: fix potential race between s_group_info online resizing and access 2020-04-07 14:04:13 +02:00
extents_status.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
extents_status.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
extents.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
file.c ext4: fix data corruption caused by unaligned direct AIO 2020-04-06 10:58:16 +02:00
fscrypt_knox_private.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
fsync.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
hash.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ialloc.c ext4: fix potential race between s_flex_groups online resizing and access 2020-04-07 14:04:11 +02:00
indirect.c ext4: cleanup bh release code in ext4_ind_remove_space() 2020-04-06 13:43:42 +02:00
inline.c ext4: set error return correctly when ext4_htree_store_dirent fails 2020-04-07 13:42:46 +02:00
inode.c ext4: fix a data race in EXT4_I(inode)->i_disksize 2020-04-07 14:03:41 +02:00
ioctl.c ext4: actually request zeroing of inode table after grow 2020-04-06 18:12:36 +02:00
Kconfig A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Makefile A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
mballoc.c ext4: fix potential race between s_group_info online resizing and access 2020-04-07 14:04:13 +02:00
mballoc.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
migrate.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
mmp.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
move_extent.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
namei.c ext4: add cond_resched() to __ext4_find_entry() 2020-04-07 14:03:43 +02:00
page-io.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
readpage.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
resize.c ext4: fix potential race between s_flex_groups online resizing and access 2020-04-07 14:04:11 +02:00
super.c ext4: potential crash on allocation error in ext4_alloc_flex_bg_array() 2020-04-07 14:04:41 +02:00
symlink.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
sysfs.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
truncate.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
xattr_security.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
xattr_trusted.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
xattr_user.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
xattr.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
xattr.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30