Messages in this thread | | | Date | Mon, 23 Jan 2006 16:07:03 -0500 (EST) | From | Alan Stern <> | Subject | Re: [PATCH] driver core: remove unneeded klist methods |
| |
On Sun, 22 Jan 2006, James Bottomley wrote:
> Sorry ... forgot to mention that part ... the change from _del to > _remove ties us up with a wait for the list to actually remove. This is > potentially dangerous because you're waiting on events you don't > control.
I forgot to mention in my earlier reply...
If you don't do something like klist_remove, then you have a dangerous race: removing a device while a driver is being added. It's possible that the driver_attach routine could iterate up to the device and then bind it to the driver after the device had been unregistered. The device structure would be deallocated when the iterator moved on, without ever getting unbound from the driver.
This problem could be avoided if driver_probe_device had some way to recognize that the driver under consideration had been unregistered, but right now there is no way for it to tell. The driver_is_registered inline routine merely tests the embedded klist_node to see if it is still on the bus's klist -- which it would be, because removal from that klist is precisely what you are trying to avoid waiting for.
Alan Stern
- 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/
| |