Bug in fb_open()?
From: Kronos <hidden>
Date: 2004-06-12 14:50:30
Hi,
in fb_open (linux 2.6) there's the following code:
static int
fb_open(struct inode *inode, struct file *file) {
...
if (!(info = registered_fb[fbidx]))
return -ENODEV;
if (!try_module_get(info->fbops->owner))
return -ENODEV;
...
}
Now, what prevents a module from going away after the first check but
before the try_module_get? Since info is kmalloc()'ed and kfree()'ed by
the module we will dereference a dangling pointer, no?
struct file_operations is declared in fbmem.c, so the ->open (in
char_dev.c) won't affect module refcount.
IMHO it is wrong to put the 'owner' field in a structure owner by the
module since it can vanish at any time.
Am I missing something?
Luca
PS: yes, I'm still working on sysfs, but I'm very busy ATM.
--
Home: http://kronoz.cjb.net
Recursion n.:
See Recursion.
-------------------------------------------------------
This SF.Net email is sponsored by the new InstallShield X.
From Windows to Linux, servers to mobile, InstallShield X is the
one installation-authoring solution that does it all. Learn more and
evaluate today! http://www.installshield.com/Dev2Dev/0504