linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Alexander Viro <viro@zeniv.linux.org.uk>,
	David Woodhouse <dwmw2@infradead.org>
Cc: linux-fsdevel@vger.kernel.org, linux-mtd@lists.infradead.org,
	David Howells <dhowells@redhat.com>,
	Bernd Schmidt <bernd.schmidt@analog.com>,
	Alexander Shishkin <virtuoso@slind.org>
Subject: [BUG] Rewriting backing_dev_info in MTD
Date: Tue, 13 Apr 2010 14:33:01 +0300	[thread overview]
Message-ID: <g2ycc557aab1004130433g537f417ch401a97e5031f77ff@mail.gmail.com> (raw)

I've got NULL-pointer dereference in __mark_inode_dirty() on chmod()
for MTD device node. wb->bdi was NULL in this case.

During investigation I've found that MTD subsystem rewrites
file->f_mapping->backing_dev_info on openning to get mmap() work on
MMU-less systems. But in fact it rewrites
inode->i_mapping->backing_dev_info too, since inode->i_mapping ==
file->f_mapping (see __dentry_open() in fs/open.c). It breaks
writeback of inode changes.

I guess the right way to fix this is changing of __dentry_open() to
create _copy_ of i_mapping to assign to f_mapping since in common case
f_mapping != i_mapping. But I'm not sure were the copy should be
freed.

What do you think?

             reply	other threads:[~2010-04-13 11:33 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-13 11:33 Kirill A. Shutemov [this message]
2010-04-15 17:23 ` [BUG] Rewriting backing_dev_info in MTD Jan Kara
2010-04-21 15:21   ` [PATCH] mtd: Do not corrupt backing device for inode Kirill A. Shutemov
2010-04-22 11:08     ` David Woodhouse
2010-04-22 15:20       ` Jan Kara
2010-05-03 16:56       ` [PATCH] mtd: Do not corrupt backing device of device node inode Kirill A. Shutemov
2010-05-03 18:54         ` Jan Kara

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=g2ycc557aab1004130433g537f417ch401a97e5031f77ff@mail.gmail.com \
    --to=kirill@shutemov.name \
    --cc=bernd.schmidt@analog.com \
    --cc=dhowells@redhat.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=virtuoso@slind.org \
    /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).