From: Jan Kara <jack@suse.cz>
To: Chandan Rajendra <chandan@linux.vnet.ibm.com>
Cc: linux-ext4@vger.kernel.org, tytso@mit.edu, jack@suse.cz,
adilger@dilger.ca
Subject: Re: [PATCH V2] ext4: ext4_mb_seq_groups_show: Fix stack memory corruption
Date: Thu, 10 Nov 2016 18:13:46 +0100 [thread overview]
Message-ID: <20161110171346.GA31098@quack2.suse.cz> (raw)
In-Reply-To: <1478756764-4459-1-git-send-email-chandan@linux.vnet.ibm.com>
On Thu 10-11-16 11:16:04, Chandan Rajendra wrote:
> 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@linux.vnet.ibm.com>
Looks good. You can add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> 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
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
next prev parent reply other threads:[~2016-11-10 17:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-10 5:46 [PATCH V2] ext4: ext4_mb_seq_groups_show: Fix stack memory corruption Chandan Rajendra
2016-11-10 17:13 ` Jan Kara [this message]
2016-11-15 2:35 ` Theodore Ts'o
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161110171346.GA31098@quack2.suse.cz \
--to=jack@suse.cz \
--cc=adilger@dilger.ca \
--cc=chandan@linux.vnet.ibm.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).