[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1478756764-4459-1-git-send-email-chandan@linux.vnet.ibm.com>
Date: Thu, 10 Nov 2016 11:16:04 +0530
From: Chandan Rajendra <chandan@...ux.vnet.ibm.com>
To: linux-ext4@...r.kernel.org
Cc: Chandan Rajendra <chandan@...ux.vnet.ibm.com>, tytso@....edu,
jack@...e.cz, adilger@...ger.ca
Subject: [PATCH V2] ext4: ext4_mb_seq_groups_show: Fix stack memory corruption
The number of 'counters' elements needed in 'struct sg' is
super_block->s_blocksize_bits + 2. Presently we have 16 'counters'
elements in the array. This is insufficient for block sizes >= 32k. In
such cases the memcpy operation performed in ext4_mb_seq_groups_show()
would cause stack memory corruption.
Signed-off-by: Chandan Rajendra <chandan@...ux.vnet.ibm.com>
---
Changelog:
v1->v2: Use EXT4_MAX_BLOCK_LOG_SIZE instead of the integer constant 16.
fs/ext4/mballoc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index a937ac7..7ae43c5 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -2287,7 +2287,7 @@ static int ext4_mb_seq_groups_show(struct seq_file *seq, void *v)
struct ext4_group_info *grinfo;
struct sg {
struct ext4_group_info info;
- ext4_grpblk_t counters[16];
+ ext4_grpblk_t counters[EXT4_MAX_BLOCK_LOG_SIZE + 2];
} sg;
group--;
--
2.5.5
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists