From: "Jörn Engel" <joern@logfs.org>
To: Alexey Korolev <akorolev@infradead.org>
Cc: nickpiggin@yahoo.com.au, akpm@linux-foundation.org,
dwmw2@infradead.org, vailiy.leonenko@intel.com,
linux-mtd@lists.infradead.org
Subject: Re: [PATCH] JFFS2 Fix of panics caused by wrong condition for hole frag creation in write_begin
Date: Mon, 14 Apr 2008 20:21:23 +0200 [thread overview]
Message-ID: <20080414182123.GA2091@logfs.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0804141747020.15842@pentafluge.infradead.org>
On Mon, 14 April 2008 17:55:22 +0100, Alexey Korolev wrote:
>
> JFFS2 in Linux 2.6.24 fails to kernel panic on random read/write/truncate operatons. We investigated the issue it is caused by
> bug in conditions for hole fragment creation in write_begin function. Offset of starting offset which is used to identify should we create hole frag or not is calculated improperly.
> As result hole frags are not created when they must be - it leads to internal memory corruptions and kernel panic.
>
> The following patch fixes the bug in JFFS2 write_begin hole frag conditions.
> Please include the patch.
Description is rather wide.
Reviewed-By: Joern Engel <joern@logfs.org>
> Signed-off-by: Alexey Korolev <akorolev@infradead.org>
> Signed-off-by: Vasiliy Leonenko <vasiliy.leonenko@mail.ru>
> =========================================
> diff -aupNr a/fs/jffs2/file.c b/fs/jffs2/file.c
> --- a/fs/jffs2/file.c 2008-02-11 08:51:11.000000000 +0300
> +++ b/fs/jffs2/file.c 2008-04-11 13:54:08.000000000 +0400
> @@ -129,13 +129,14 @@ static int jffs2_write_begin(struct file
> struct inode *inode = mapping->host;
> struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode);
> pgoff_t index = pos >> PAGE_CACHE_SHIFT;
> - uint32_t pageofs = pos & (PAGE_CACHE_SIZE - 1);
> + uint32_t pageofs;
> int ret = 0;
>
> pg = __grab_cache_page(mapping, index);
> if (!pg)
> return -ENOMEM;
> *pagep = pg;
> + pageofs = pg->index << PAGE_CACHE_SHIFT;
>
> D1(printk(KERN_DEBUG "jffs2_write_begin()\n"));
> =========================================
>
> Thanks,
> Alexey
Jörn
--
My second remark is that our intellectual powers are rather geared to
master static relations and that our powers to visualize processes
evolving in time are relatively poorly developed.
-- Edsger W. Dijkstra
next prev parent reply other threads:[~2008-04-14 18:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-14 16:55 [PATCH] JFFS2 Fix of panics caused by wrong condition for hole frag creation in write_begin Alexey Korolev
2008-04-14 18:21 ` Jörn Engel [this message]
2008-04-14 19:40 ` David Woodhouse
2008-04-14 19:50 ` David Woodhouse
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=20080414182123.GA2091@logfs.org \
--to=joern@logfs.org \
--cc=akorolev@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=dwmw2@infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=nickpiggin@yahoo.com.au \
--cc=vailiy.leonenko@intel.com \
/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