1 ext4: fix stack memory corruption with 64k block size
3 From: Chandan Rajendra <chandan@linux.vnet.ibm.com>
5 The number of 'counters' elements needed in 'struct sg' is
6 super_block->s_blocksize_bits + 2. Presently we have 16 'counters'
7 elements in the array. This is insufficient for block sizes >= 32k. In
8 such cases the memcpy operation performed in ext4_mb_seq_groups_show()
9 would cause stack memory corruption.
12 Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
13 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
14 Reviewed-by: Jan Kara <jack@suse.cz>
15 Cc: stable@vger.kernel.org
18 v1->v2: Use EXT4_MAX_BLOCK_LOG_SIZE instead of the integer constant 16.
20 fs/ext4/mballoc.c | 2 +-
21 1 file changed, 1 insertion(+), 1 deletion(-)
23 diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
24 index a937ac7..7ae43c5 100644
25 --- a/fs/ext4/mballoc.c
26 +++ b/fs/ext4/mballoc.c
27 @@ -2287,7 +2287,7 @@ static int ext4_mb_seq_groups_show(struct seq_file *seq, void *v)
28 struct ext4_group_info *grinfo;
30 struct ext4_group_info info;
31 - ext4_grpblk_t counters[16];
32 + ext4_grpblk_t counters[EXT4_MAX_BLOCK_LOG_SIZE + 2];