From: Anton Vorontsov <avorontsov@ru.mvista.com>
To: akpm@linux-foundation.org
Cc: neilb@suse.de, linux-mtd@lists.infradead.org, dwmw2@infradead.org
Subject: Re: [patch 1/5] jffs2: fix memory corruption in jffs2_read_inode_range()
Date: Wed, 3 Feb 2010 01:50:47 +0300 [thread overview]
Message-ID: <20100202225047.GA20293@oksana.dev.rtsoft.ru> (raw)
In-Reply-To: <201002022243.o12Mh9er019176@imap1.linux-foundation.org>
On Tue, Feb 02, 2010 at 02:43:09PM -0800, akpm@linux-foundation.org wrote:
> From: Anton Vorontsov <avorontsov@ru.mvista.com>
>
> In 2.6.23 kernel, commit a32ea1e1f925399e0d81ca3f7394a44a6dafa12c ("Fix
> read/truncate race") fixed a race in the generic code, and as a side
> effect, now do_generic_file_read() can ask us to readpage() past the
> i_size, which seems to be correctly handled by the block routines (e.g.
> block_read_full_page() fills the page with zeroes in case if somebody is
> trying to read past the last inode's block).
[...]
> Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
> Cc: David Woodhouse <dwmw2@infradead.org>
> Cc: Neil Brown <neilb@suse.de>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
Andrew,
Please drop this patch. David's version of that fix is
already in the mainline:
commit 199bc9ff5ca5e4b3bcaff8927b2983c65f34c263
Author: David Woodhouse <dwmw2@infradead.org>
Date: Mon Nov 30 09:06:40 2009 +0000
jffs2: Fix memory corruption in jffs2_read_inode_range()
Thanks!
> fs/jffs2/file.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff -puN fs/jffs2/file.c~jffs2-fix-memory-corruption-in-jffs2_read_inode_range fs/jffs2/file.c
> --- a/fs/jffs2/file.c~jffs2-fix-memory-corruption-in-jffs2_read_inode_range
> +++ a/fs/jffs2/file.c
> @@ -85,7 +85,13 @@ static int jffs2_do_readpage_nolock (str
> pg_buf = kmap(pg);
> /* FIXME: Can kmap fail? */
>
> - ret = jffs2_read_inode_range(c, f, pg_buf, pg->index << PAGE_CACHE_SHIFT, PAGE_CACHE_SIZE);
> + if (pg->index > ((i_size_read(inode) - 1) >> PAGE_CACHE_SHIFT)) {
> + ret = 0;
> + memset(pg_buf, 0, PAGE_CACHE_SIZE);
> + } else {
> + ret = jffs2_read_inode_range(c, f, pg_buf,
> + pg->index << PAGE_CACHE_SHIFT, PAGE_CACHE_SIZE);
> + }
>
> if (ret) {
> ClearPageUptodate(pg);
> _
--
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2
next prev parent reply other threads:[~2010-02-02 22:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-02 22:43 [patch 1/5] jffs2: fix memory corruption in jffs2_read_inode_range() akpm
2010-02-02 22:50 ` Anton Vorontsov [this message]
2010-02-09 13:26 ` Artem Bityutskiy
2010-02-09 13:30 ` Anton Vorontsov
2010-02-09 13:33 ` Artem Bityutskiy
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=20100202225047.GA20293@oksana.dev.rtsoft.ru \
--to=avorontsov@ru.mvista.com \
--cc=akpm@linux-foundation.org \
--cc=dwmw2@infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=neilb@suse.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.