public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* PCI driver module unload race?
@ 2003-03-08 10:47 Russell King
  2003-03-08 19:12 ` Greg KH
  0 siblings, 1 reply; 23+ messages in thread
From: Russell King @ 2003-03-08 10:47 UTC (permalink / raw)
  To: Linux Kernel List
  Cc: Patrick Mochel, Ivan Kokshaysky, Jeff Garzik, Greg KH,
	Rusty Russell

Hi,

What prevents the following scenario from happening?  It's purely
theoretical - I haven't seen this occuring.

- Load PCI driver.

- PCI driver registers using pci_module_init(), and adds itself to sysfs.

- Hot-plugin a PCI device which uses this driver.  sysfs matches the PCI
  driver, and calls the PCI drivers probe function.

- The probe function calls kmalloc or some other function which sleeps
  (or gets preempted, if CONFIG_PREEMPT is enabled.)

- We switch to another thread, which happens to be rmmod for this PCI
  driver.  We remove the driver since it has a use count of zero.

- We switch back to the PCI driver.  Oops.

I've probably missed something, but I don't think so.  I suspect we need
struct device_driver to include a struct module pointer which sysfs can
take before calling any driver functions.

Comments?

-- 
Russell King (rmk@arm.linux.org.uk)                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html


^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2003-03-17 17:34 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-08 10:47 PCI driver module unload race? Russell King
2003-03-08 19:12 ` Greg KH
2003-03-08 19:47   ` Petr Vandrovec
2003-03-08 19:51     ` Greg KH
2003-03-09  2:33       ` Petr Vandrovec
2003-03-08 20:03     ` Russell King
2003-03-08 20:09   ` Russell King
2003-03-08 20:21     ` Greg KH
2003-03-10 21:44       ` Greg KH
2003-03-10 23:48         ` Oliver Neukum
2003-03-10 23:51           ` Greg KH
2003-03-11  1:04             ` Roman Zippel
2003-03-11  1:15               ` Greg KH
2003-03-11  9:00                 ` Oliver Neukum
2003-03-11 15:06                   ` Patrick Mochel
2003-03-11 16:07                     ` Oliver Neukum
2003-03-16 13:13                       ` Rusty Russell
2003-03-11 11:05                 ` Roman Zippel
2003-03-11 15:27                   ` Patrick Mochel
2003-03-11 20:09                     ` Roman Zippel
2003-03-11 19:15                       ` Patrick Mochel
2003-03-12  2:28                         ` Roman Zippel
2003-03-16 13:05                     ` Rusty Russell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox