Re: usb_authorize_device and usb_deauthorize_device

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

 



Alan Stern wrote:
> Inaky and David:
> 
> Looking through usb_authorize_device() and usb_deauthorize_device(), 
> those two routines appear to have several problems:

I think the whole concept doesn't really fit with how the Wireless USB
protocol works.  I'd like to see.

* The device's "authorized" flag renamed to "authenticated" (similarly
renaming the HCD's authorized_default flag to
"devices_require_authentication").

* The "authorized" sysfs file renamed to "authenticated" and made read-only.

* The "authorized_default" sysfs file removed.

* usb_deauthorize_device() removed.

* usb_authorize_device() renamed to usb_device_authenticated() and
called from the WUSB core when a device is authenticated.

It would also be nice to get the core to call usb_device_authenticated()
for newly connected wired devices.  The should reduce some code duplication.

> 
> 	usb_authorize_device() calls usb_autoresume_device() but
> 	not usb_autosuspend_device().  It this a simple oversight?

I guess.  I don't understand how this autosuspend thing is supposed to
work though.

> 	usb_deauthorize_device() frees a lot of refcounted data
> 	structures without regard to the refcounts.  Why doesn't
> 	it leave them to be deallocated in the normal way?
> 
> 	usb_deauthorize_device() leaks several strings.  Oddly
> 	enough, usb_authorize_device() handles them correctly.  But
> 	it races with the strings' show routines in sysfs.c,
> 	because those routines don't acquire the device lock.

Shouldn't the show routines take the device lock then?

> Does either of you want to fix these issues?

I don't have time until Jan/Feb next year at the earliest.

David
-- 
David Vrabel, Senior Software Engineer, Drivers
CSR, Churchill House, Cambridge Business Park,  Tel: +44 (0)1223 692562
Cowley Road, Cambridge, CB4 0WZ                 http://www.csr.com/


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
--
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