Re: PCI driver module unload race?

From: Patrick Mochel (mochel@osdl.org)
Date: Tue Mar 11 2003 - 10:06:54 EST


> > > I think it's not easy. I haven't studied the code completely yet, but
> > > e.g. when you attach a device to a driver you also have to get a
> > > reference to the driver.
> >
> > You get a link to the driver, but you can't increment the module count
> > of the driver at that time, as we have to be able to remove a module
> > somehow :)
>
> That is simple. Export a generic way to disconnect a driver from a device.

It's not that easy - Linux has always supported the operation of being
able to remove a module while it is attached to devices. The reference
count only goes up if a device is opened.

This means the module refcount must remain at 0, even after it's bound to
devices. Changing this would require a change in visible behavior, and
require an extra step by a user to disconnect the driver before they
unload the module.

        -pat

-
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/



This archive was generated by hypermail 2b29 : Sat Mar 15 2003 - 22:00:26 EST