Re: [PATCH v4 11/14] usb: introduce port status lock

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

 



On Thu, 20 Feb 2014, Dan Williams wrote:

> > You forgot to acquire the port lock in usb_reset_device.  The lock and
> > unlock calls should surround the call to usb_reset_and_verify_device.
> > Both that routine and hub_port_init should be documented as requiring
> > their caller to hold the port lock.
> 
> This might be a reason to move the lock to the usb_device itself.

That's not feasible, because we have to acquire the lock at times where 
there's no device plugged into the port.

> Otherwise we'll end up with a conditional lock when resetting root hub
> devices.  Sparse will not be able to statically verify such a lock
> [1].  I had assumed that calliing usb_reset_device() on a root hub was
> not allowed.

It isn't.  When you think about it, there is no way to reset a root 
hub.  (Or at least, not anything resembling the way you reset an 
external hub.)

> Hmm, maybe better to just up-level the udev->parent check to
> usb_reset_device directly.

There is one place where usb_reset_and_verify_device is called 
directly, not through usb_reset_device.  (But that place doesn't need 
the check, so moving it wouldn't hurt anything...)

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