usbatm subdriver registration w/o .driver_info
rkagan at mail.ru
Thu Jan 27 06:41:59 EST 2005
On Thu, Jan 27, 2005 at 12:30:47PM +0100, Duncan Sands wrote:
> Hi Roman, you need to add a lock, otherwise this
> > + list_for_each_entry(driver, &usbatm_driver_list, driver_list)
> > + if (usb_match_id(intf, driver->id_table))
> > + break;
> > +
> might run at the same time as this
> > + list_add(&driver->driver_list, &usbatm_driver_list);
> or this
> > + list_del(&driver->driver_list);
> corrupting the list.
Right, that's exactly what I said in the first mail. Note however that
list mutation is serialized by the module loading subsystem, and the
presence of the right driver on the list at probe time is guaranteed by
the USB subsystem. So the only thing we need to make sure is that list
traversal doesn't fail. I thought that choosing the appropriate list
primitives would do the job without locks.
As a side note, this problem is present in the usb-serial too.
> Or are you relying on the big kernel lock?
No I'd rather not.
More information about the Usbatm