From: "Andreas Bießmann" <andreas.devel@googlemail.com>
To: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: "Andreas Bießmann" <biessmann@corscience.de>,
linux-kernel@vger.kernel.org,
"Alexander Viro" <viro@zeniv.linux.org.uk>,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] fs-writeback: fix NULL pointer dereference in __mark_inode_dirty
Date: Mon, 28 Feb 2011 16:59:34 +0100 [thread overview]
Message-ID: <4D6BC666.4010603@gmail.com> (raw)
In-Reply-To: <20110228154314.GA4675@swordfish.minsk.epam.com>
Dear Sergey Senozhatsky,
Am 28.02.2011 16:43, schrieb Sergey Senozhatsky:
> On (02/28/11 16:25), Andreas Bießmann wrote:
>> The reference to sb->s_bdi may be deleted from mmc_blk_remove() ->
>> del_gendisk() -> unlink_gendisk() -> bdi_unregister() -> bdi_prune_sb() while
>> another instance try to write some data to the device.
>>
>> Signed-off-by: Andreas Bießmann <biessmann@corscience.de>
>> ---
>> fs/fs-writeback.c | 3 +++
>> 1 files changed, 3 insertions(+), 0 deletions(-)
>>
>> diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
>> index cdbf7ac..96b4b25 100644
>> --- a/fs/fs-writeback.c
>> +++ b/fs/fs-writeback.c
>> @@ -1047,6 +1047,9 @@ void __mark_inode_dirty(struct inode *inode, int flags)
>> if (!was_dirty) {
>> bdi = inode_to_bdi(inode);
>>
>> + if (!bdi)
>> + goto out;
>> +
>> if (bdi_cap_writeback_dirty(bdi)) {
>> WARN(!test_bit(BDI_registered, &bdi->state),
>> "bdi-%s not registered\n", bdi->name);
>
> Hello,
> I had something very similar to this some time ago
> https://lkml.org/lkml/2010/12/9/436
Sorry, I did not see that patch.
> However, I'm not sure that this check is sufficient.
Why are you think this is not sufficient?
If an instance try to write that specific inode to an physical device
which is not longer available how should we react then?
Another solution could be to clean up all instances referring to that
superblock in del_/unlink_gendisk(). But I think to check the return of
inode_to_bdi() is needed in any case.
regards
Andreas Bießmann
next prev parent reply other threads:[~2011-02-28 15:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-28 15:25 [PATCH] fs-writeback: fix NULL pointer dereference in __mark_inode_dirty Andreas Bießmann
2011-02-28 15:43 ` Sergey Senozhatsky
2011-02-28 15:59 ` Andreas Bießmann [this message]
2011-02-28 16:29 ` Sergey Senozhatsky
[not found] ` <AANLkTimARkrtmBBgtXmNA=MOD94FWQ8x-qcmLJ8mdQ6o@mail.gmail.com>
2011-03-02 8:35 ` Andreas Bießmann
2011-03-03 13:58 ` Andreas Bießmann
2011-03-17 21:04 ` Andrew Morton
2011-03-17 21:06 ` George Spelvin
2011-03-17 22:19 ` Sergey Senozhatsky
[not found] <fa.8ND6HoGS9dKYUuniFCAoNq+1TFY@ifi.uio.no>
[not found] ` <4D78AA72.3060202@secunet.com>
[not found] ` <4D7F3CD5.9030105@secunet.com>
2011-03-15 12:11 ` [PATCH] fs-writeback: fix NULL pointer dereference in, __mark_inode_dirty Anton Altaparmakov
2011-03-15 12:35 ` Jens Axboe
2011-03-15 12:40 ` Torsten Hilbrich
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=4D6BC666.4010603@gmail.com \
--to=andreas.devel@googlemail.com \
--cc=biessmann@corscience.de \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sergey.senozhatsky@gmail.com \
--cc=viro@zeniv.linux.org.uk \
/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).