linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: "Antonino A. Daplas" <adaplas@gmail.com>
Cc: linux-fbdev-devel@lists.sourceforge.net, gtolstolytkin@ru.mvista.com
Subject: Re: [PATCH 1/3] fbdev: Add framebuffer and display update module support for pnx4008
Date: Fri, 30 Jun 2006 22:11:36 -0700	[thread overview]
Message-ID: <20060630221136.6ddc1ef3.akpm@osdl.org> (raw)
In-Reply-To: <44A601DB.5090807@gmail.com>

On Sat, 01 Jul 2006 13:02:19 +0800
"Antonino A. Daplas" <adaplas@gmail.com> wrote:

> Andrew Morton wrote:
> > On Fri, 30 Jun 2006 20:00:23 +0800
> > "Antonino A. Daplas" <adaplas@gmail.com> wrote:
> > 
> >> +static struct fb_var_screeninfo rgbfb_var __initdata = {
> > 
> > Is that right?  We later do
> > 
> > +       info->var = rgbfb_var;
> > 
> > but rgbfb_var is about to be unloaded from memory.  I suspect this'll crash
> > if the driver is statically linked into the kernel.
> > 
> 
> Should be okay, as the assignment is done during init only.

But we're setting info->var to point at memory which will be freed up by
free_initmem().

So if anyone _uses_ info->var after free_initmem() they'll reference random
memory or they'll oops.

Looking at, say, drivers/video/vfb.c:vfb_probe(), I see

	info->var = vfb_default;

vfb_default is __init and `info' has a lifetime beyond the execution of
this function.  It looks wrong.

Bear in mind that the __init and __initdata segments do not get unloaded if
the code is compiled as a module (yet).  So the problems only become
apparent when the driver is linked into vmlinux.

Also, we'll now get section mismatch warnings from the kbuild tools.  But
they won't help us in this case because vfb_probe() is __init.

> But it should be __devinitdata, not __initdata (or vice versa).  

Yes, the driver seems a bit confused about that also.


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

  reply	other threads:[~2006-07-01  5:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-30 12:00 [PATCH 1/3] fbdev: Add framebuffer and display update module support for pnx4008 Antonino A. Daplas
2006-07-01  3:43 ` Andrew Morton
2006-07-01  5:02   ` Antonino A. Daplas
2006-07-01  5:11     ` Andrew Morton [this message]
2006-07-01  5:18       ` Antonino A. Daplas
2006-07-01  5:45         ` Andrew Morton
2006-07-01  8:25           ` Antonino A. Daplas
2006-07-01  3:44 ` Andrew Morton
2006-07-01  5:03   ` Antonino A. Daplas
2006-07-01  3:46 ` Andrew Morton
2006-07-01  5:02   ` Antonino A. Daplas

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=20060630221136.6ddc1ef3.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=adaplas@gmail.com \
    --cc=gtolstolytkin@ru.mvista.com \
    --cc=linux-fbdev-devel@lists.sourceforge.net \
    /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).