mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Evgeniy Polyakov <zbr@ioremap.net>
To: Alexander Beregalov <a.beregalov@gmail.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	jens.axboe@oracle.com
Subject: Re: 2.6.32-rc8: pohmelfs: NULL pointer dereference
Date: Thu, 3 Dec 2009 01:23:21 +0300	[thread overview]
Message-ID: <20091202222321.GB17579@ioremap.net> (raw)
In-Reply-To: <a4423d670912011711s584f46d2y8a583618abe4a620@mail.gmail.com>

Hi Alexander.

Thanks a lot for you report and analysis!

On Wed, Dec 02, 2009 at 04:11:52AM +0300, Alexander Beregalov (a.beregalov@gmail.com) wrote:
> BUG: unable to handle kernel NULL pointer dereference at 000000b8
> IP: [<c10a96f9>] bdi_queue_work+0x9/0xa0
> 
>  [<c10a97e6>] ? sync_inodes_sb+0x46/0x120
>  [<c13cbafd>] ? printk+0x18/0x1b
>  [<f840d8cb>] ? pohmelfs_kill_super+0xb/0x20 [pohmelfs]
>  [<c1090b8a>] ? deactivate_locked_super+0x4a/0x70
>  [<c1090ccf>] ? get_sb_nodev+0x6f/0x80
>  [<f840d8fc>] ? pohmelfs_get_sb+0x1c/0x20 [pohmelfs]
>  [<f840e120>] ? pohmelfs_fill_super+0x0/0x530 [pohmelfs]
>  [<c108fe50>] ? vfs_kern_mount+0x40/0xd0
> 
> 
> The problem is that pohmelfs_fill_super() does not set sb->s_bdi.
> Behavior was changed by
> b6e51316da writeback: separate starting of sync vs opportunistic writeback
> d8a8559cd7 writeback: get rid of generic_sync_sb_inodes() export

Looks like this change broke things:

-long sync_inodes_sb(struct super_block *sb)
+void sync_inodes_sb(struct super_block *sb)
{
-       struct writeback_control wbc = {
-               .sb             = sb,
-               .bdi            = sb->s_bdi,
-               .sync_mode      = WB_SYNC_ALL,
-               .range_start    = 0,
-               .range_end      = LLONG_MAX,
-       };
-       long nr_to_write = LONG_MAX; /* doesn't actually matter */
-
-       wbc.nr_to_write = nr_to_write;
-       bdi_start_writeback(&wbc);
-       wait_sb_inodes(&wbc);
-       return nr_to_write - wbc.nr_to_write;
+       bdi_sync_writeback(sb->s_bdi, sb);
+       wait_sb_inodes(sb);

POHMELFS does not set sb->s_bdi, so it will be dereferenced in
bdi_queue_work() and crash. Jens, should it check whether bdi is NULL in
bdi_sync_writeback()?

-- 
	Evgeniy Polyakov

      reply	other threads:[~2009-12-02 22:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-02  1:11 Alexander Beregalov
2009-12-02 22:23 ` Evgeniy Polyakov [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=20091202222321.GB17579@ioremap.net \
    --to=zbr@ioremap.net \
    --cc=a.beregalov@gmail.com \
    --cc=jens.axboe@oracle.com \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®