[lkml]   [2003]   [Jul]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] Remove module reference counting.
On Fri, Jul 25, 2003 at 04:00:18AM +1000, Rusty Russell wrote:
> Hi all,
> When the initial module patch was submitted, it made modules
> start isolated, so they would not be accessible until (if)
> initialization had succeeded. This broke partition scanning, and was
> immediately reverted, leaving us with a module reference count scheme
> identical to the previous one (just a faster implementation): we still
> have cases where modules can be access on failed load.
> Then Dave decided that the work of reference counting network
> driver modules everywhere is too invasive, so network driver modules
> now have zero reference counts always. The idea is that if you don't
> want the module removed, don't do it. ie. only remove the module if
> there's a bug, or you want to replace it.

Hm, as long as we add a kobject to the module structure, so that users
of a module can be tracked somehow to know if it is safe to unload the
module or not.

This is because there is a difference between device reference counts,
and code reference counts, which is why I added the module owner logic
to sysfs attributes, to prevent code from being unloaded when the device
might already be gone.

So can the following situation still work with this proposed patch:
- device created
- sysfs files created associated with that device
- user opens sysfs file
- user disconnects sysfs files.
- device goes away, driver no longer references device, but
kobject count is still incremented.
- driver associated with device is unloaded.
- user reads sysfs file previously opened (which calls into
module memory that is now gone.)

Can we still prevent this from happening now? I think if we add a
kobject (or something, we still need a kobject to get module
parameters so might as well use that), we might be safe.


greg k-h
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:47    [W:0.184 / U:0.640 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site