Re: possible race in usb_autopm_get_interface_async()

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

 



On Thu, 4 Jun 2009, Oliver Neukum wrote:

> Am Mittwoch, 3. Juni 2009 18:37:38 schrieb Alan Stern:
> > On Wed, 3 Jun 2009, Oliver Neukum wrote:
> > > Hi Alan,
> > >
> > > I am looking at using the interface in practice. It seems to me that
> > > pm_usage_cnt can become corrupted if usb_autopm_get_interface_async()
> > > and usb_autopm_put_interface_async() race. Convert it to atomic_t?
> >
> > Or else have the driver do some sort of locking.  You'd probably want
> > locking anyway.
> 
> The problem with that is that it is a difference in behavior to the sync
> versions. It violates the principle of least surprise.

We could convert the field to atomic_t; it wouldn't bother anyone.  
However it is worthwhile mentioning that this behavior of the async
routines _is_ documented in Documentation/usb/power-management.txt.

By the way, what is your application?  And doesn't it turn out that you
naturally want to hold a private lock during these calls anyway?

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