linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Johannes Weiner <hannes@cmpxchg.org>,
	penberg@cs.helsinki.fi, linux-kernel@vger.kernel.org,
	linux-fbdev-devel@lists.sourceforge.net
Subject: Re: [patch] fbcon: don't use vc_resize() on initialization
Date: Fri, 31 Jul 2009 10:09:15 +0100	[thread overview]
Message-ID: <1249031355.29967.1.camel@pc1117.cambridge.arm.com> (raw)
In-Reply-To: <20090730161149.657e8e9a.akpm@linux-foundation.org>

On Thu, 2009-07-30 at 16:11 -0700, Andrew Morton wrote:
> On Wed, 29 Jul 2009 19:21:23 +0200
> Johannes Weiner <hannes@cmpxchg.org> wrote:
> 
> > Catalin and kmemleak spotted a leak of a VC screen buffer in
> > vc_allocate() due to the following chain of events:
> > 
> > 	vc_allocate()
> > 	  visual_init(init=1)
> > 	    vc->vc_sw->con_init(init=1)
> >               fbcon_init()
> > 	        vc_resize()
> > 	          vc->screen_buf = kmalloc()
> > 	  vc->screen_buf = kmalloc()
> > 
> > The common way for the VC drivers is to set the screen dimension
> > parameters manually in the init case and only call vc_resize() for
> > !init - which allocates a screen buffer according to the new
> > dimensions.
> > 
> > fbcon instead would do vc_resize() unconditionally and afterwards set
> > the dimensions manually (again) for !init - i.e. completely upside
> > down.  The vc_resize() allocated buffer would then get lost by
> > vc_allocate() allocating a fresh one.
> > 
> > Use vc_resize() only for actual resizing to close the leak.
> > 
> > Set the dimensions manually only in initialization mode to remove the
> > redundant setting in resize mode.
> > 
> > The kmemleak trace from Catalin:
> > 
> > unreferenced object 0xde158000 (size 12288):
> 
> That's a big leak!
> 
> What sequence of user actions would cause it to occur?

In my case, I think anything that causes a tty_open() call with a
framebuffer console. I get a leak when logging in on the console and
another when starting the X server.

-- 
Catalin

      reply	other threads:[~2009-07-31  9:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1248859884.2305.7.camel@pc1117.cambridge.arm.com>
     [not found] ` <20090729103903.GA2175@cmpxchg.org>
     [not found]   ` <1248865456.2305.12.camel@pc1117.cambridge.arm.com>
     [not found]     ` <20090729172123.GA14192@cmpxchg.org>
2009-07-30 23:11       ` [patch] fbcon: don't use vc_resize() on initialization Andrew Morton
2009-07-31  9:09         ` Catalin Marinas [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=1249031355.29967.1.camel@pc1117.cambridge.arm.com \
    --to=catalin.marinas@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-fbdev-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penberg@cs.helsinki.fi \
    /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).