Re: usbcore and the BKL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 8 Aug 2009, Jiri Kosina wrote:

> Actually, I remember having discussed this with some of you guys some time 
> ago, and I thought that the conclusion was that
> 
> a) disconnect() used to do lock_kernel()
> b) nobody has actually done the hard work of checking all open() methods 
>    for dependency on BKL

Yes, that's true in general.  But some individual cases have been done, 
and I wondered whether (or why not) usbhid was among them.

> In hiddev we need BKL simply because we need a lock which usb_open() also 
> takes in the right order, so that we avoid race between usb_register_dev() 
> and open().
> 
> We can't use simple mutex to guard hiddev_table[], because usb_open() and 
> usb_register_dev() lock minor_rwsem, and we would end up with ABBA 
> deadlock.

Tell me, why do you need hiddev_table at all?  Can't you use 
usb_find_interface() to look up devices given their minor numbers?  
That's how other USB class drivers work.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux