Re: PCI driver module unload race?

Greg KH
2003-03-11T01:15:26Z

On Tue, Mar 11, 2003 at 02:04:20AM +0100, Roman Zippel wrote:
> On Mon, 10 Mar 2003, Greg KH wrote:
>
> > > It seems that the semaphore in bus_add_device() makes this unnecessary.
> >
> > Hm, yes. I think you are correct.
> >
> > So this patch is not needed, and the struct module * can be ripped out
> > of struct usb_driver too :)
>
> 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 :)

> I think there are more interesting races, e.g. when you create a sysfs
> symlink, that symlink might also have references to a module.

Yeah, I still think there are some nasty issues with regards to being in
a sysfs directory, with a open file handle, and the module is removed.
But I haven't checked stuff like that in a while.

CONFIG_MODULE_UNLOAD, just say no.

thanks,

greg k-h