Thread (11 messages) 11 messages, 2 authors, 2006-07-01

Re: [PATCH 1/3] fbdev: Add framebuffer and display update module support for pnx4008

From: Andrew Morton <hidden>
Date: 2006-07-01 05:11:40

On Sat, 01 Jul 2006 13:02:19 +0800
"Antonino A. Daplas" [off-list ref] wrote:
Andrew Morton wrote:
quoted
On Fri, 30 Jun 2006 20:00:23 +0800
"Antonino A. Daplas" [off-list ref] wrote:
quoted
+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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help