From: Jan Kara <jack@suse.cz>
To: Theodore Ts'o <tytso@mit.edu>
Cc: Ext4 Developers List <linux-ext4@vger.kernel.org>,
stable@vger.kernel.org
Subject: Re: [PATCH] ext4: avoid clearing beyond i_blocks when truncating an inline data file
Date: Wed, 8 Jan 2014 22:46:40 +0100 [thread overview]
Message-ID: <20140108214640.GA21663@quack.suse.cz> (raw)
In-Reply-To: <1389117437-12060-1-git-send-email-tytso@mit.edu>
On Tue 07-01-14 12:57:17, Ted Tso wrote:
> A missing cast means that when we are truncating a file which is less
> than 60 bytes, we don't trunate the wrong area of memory, and in fact
> we can end up truncating the next inode in the inode table, or worse
> yet, some other kernel data structure.
Looks good (after updating the changelog as you suggested). You can add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
>
> Addresses-Coverity-Id: #751987
>
> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
> Cc: stable@vger.kernel.org
> ---
> fs/ext4/inline.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c
> index c417e52..ed29e72 100644
> --- a/fs/ext4/inline.c
> +++ b/fs/ext4/inline.c
> @@ -1928,9 +1928,11 @@ void ext4_inline_data_truncate(struct inode *inode, int *has_inline)
> }
>
> /* Clear the content within i_blocks. */
> - if (i_size < EXT4_MIN_INLINE_DATA_SIZE)
> - memset(ext4_raw_inode(&is.iloc)->i_block + i_size, 0,
> - EXT4_MIN_INLINE_DATA_SIZE - i_size);
> + if (i_size < EXT4_MIN_INLINE_DATA_SIZE) {
> + void *p = (void *) ext4_raw_inode(&is.iloc)->i_block;
> + memset(p + i_size, 0,
> + EXT4_MIN_INLINE_DATA_SIZE - i_size);
> + }
>
> EXT4_I(inode)->i_inline_size = i_size <
> EXT4_MIN_INLINE_DATA_SIZE ?
> --
> 1.8.5.rc3.362.gdf10213
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
prev parent reply other threads:[~2014-01-08 21:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-07 17:57 [PATCH] ext4: avoid clearing beyond i_blocks when truncating an inline data file Theodore Ts'o
2014-01-07 17:58 ` Theodore Ts'o
2014-01-08 21:46 ` Jan Kara [this message]
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=20140108214640.GA21663@quack.suse.cz \
--to=jack@suse.cz \
--cc=linux-ext4@vger.kernel.org \
--cc=stable@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).