lkml.org 
[lkml]   [2002]   [Jul]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Driverfs updates
Date
On Mon, 8 Jul 2002 11:41:52 -0700 (PDT), 
Patrick Mochel <mochel@osdl.org> wrote:
>- Add struct module * owner field to struct device_driver
>- Change {get,put}_driver to use it

struct device_driver * get_driver(struct device_driver * drv)
{
if (drv && drv->owner)
if (!try_inc_mod_count(drv->owner))
return NULL;
return drv;
}

is racy. The module can be unloaded after if (drv->owner) and before
try_inc_mod_count. To prevent that race, drv itself must be locked
around calls to get_driver().

The "normal" method is to have a high level lock that controls the drv
list and to take that lock in the register and unregister routines and
around the call to try_inc_mod_count. drv->bus->lock is no good,
anything that relies on reading drv without a lock or module reference
count is racy. I suggest you add a global driverfs_lock.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

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