<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/usb/core/driver.c, branch v4.9</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v4.9</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v4.9'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2016-05-03T21:32:07Z</updated>
<entry>
<title>USB: leave LPM alone if possible when binding/unbinding interface drivers</title>
<updated>2016-05-03T21:32:07Z</updated>
<author>
<name>Alan Stern</name>
<email>stern@rowland.harvard.edu</email>
</author>
<published>2016-04-29T19:25:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=6fb650d43da3e7054984dc548eaa88765a94d49f'/>
<id>urn:sha1:6fb650d43da3e7054984dc548eaa88765a94d49f</id>
<content type='text'>
When a USB driver is bound to an interface (either through probing or
by claiming it) or is unbound from an interface, the USB core always
disables Link Power Management during the transition and then
re-enables it afterward.  The reason is because the driver might want
to prevent hub-initiated link power transitions, in which case the HCD
would have to recalculate the various LPM parameters.  This
recalculation takes place when LPM is re-enabled and the new
parameters are sent to the device and its parent hub.

However, if the driver does not want to prevent hub-initiated link
power transitions then none of this work is necessary.  The parameters
don't need to be recalculated, and LPM doesn't need to be disabled and
re-enabled.

It turns out that disabling and enabling LPM can be time-consuming,
enough so that it interferes with user programs that want to claim and
release interfaces rapidly via usbfs.  Since the usbfs kernel driver
doesn't set the disable_hub_initiated_lpm flag, we can speed things up
and get the user programs to work by leaving LPM alone whenever the
flag isn't set.

And while we're improving the way disable_hub_initiated_lpm gets used,
let's also fix its kerneldoc.

Signed-off-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Tested-by: Matthew Giassa &lt;matthew@giassa.net&gt;
CC: Mathias Nyman &lt;mathias.nyman@intel.com&gt;
CC: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>USB: usb_driver_claim_interface: add sanity checking</title>
<updated>2016-03-18T16:19:02Z</updated>
<author>
<name>Oliver Neukum</name>
<email>oneukum@suse.com</email>
</author>
<published>2016-03-16T12:26:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=0b818e3956fc1ad976bee791eadcbb3b5fec5bfd'/>
<id>urn:sha1:0b818e3956fc1ad976bee791eadcbb3b5fec5bfd</id>
<content type='text'>
Attacks that trick drivers into passing a NULL pointer
to usb_driver_claim_interface() using forged descriptors are
known. This thwarts them by sanity checking.

Signed-off-by: Oliver Neukum &lt;ONeukum@suse.com&gt;
CC: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: core: driver: Use kmalloc_array</title>
<updated>2015-10-04T09:47:19Z</updated>
<author>
<name>Muhammad Falak R Wani</name>
<email>falakreyaz@gmail.com</email>
</author>
<published>2015-09-07T16:00:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=9766f2517e55338ab546891c4bfff6666ffacaea'/>
<id>urn:sha1:9766f2517e55338ab546891c4bfff6666ffacaea</id>
<content type='text'>
Use kmalloc_array instead of kmalloc to allocate memory for an array.
Also, remove the dev_warn for a memory leak, making the if check more
sleek.

Signed-off-by: Muhammad Falak R Wani &lt;falakreyaz@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: interface authorization: Control interface probing and claiming</title>
<updated>2015-09-22T19:08:40Z</updated>
<author>
<name>Stefan Koch</name>
<email>stefan.koch10@gmail.com</email>
</author>
<published>2015-08-25T19:10:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8d1f8573a33224dce9b6e3a5085a6857b7572c13'/>
<id>urn:sha1:8d1f8573a33224dce9b6e3a5085a6857b7572c13</id>
<content type='text'>
Driver probings and interface claims get rejected
if an interface is not authorized.

Signed-off-by: Stefan Koch &lt;stefan.koch10@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Revert "usb: interface authorization: Control interface probing and claiming"</title>
<updated>2015-08-18T16:58:26Z</updated>
<author>
<name>Greg Kroah-Hartman</name>
<email>gregkh@linuxfoundation.org</email>
</author>
<published>2015-08-18T16:58:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=8c2ea97a3a4124628de2ed9a1f891c706788468a'/>
<id>urn:sha1:8c2ea97a3a4124628de2ed9a1f891c706788468a</id>
<content type='text'>
This reverts commit de7718bd9c4d3db96991a98c2a0cb38258a04e47 as the
signed-off-by address is invalid.

Cc: Stefan Koch &lt;stefan.koch10@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: interface authorization: Control interface probing and claiming</title>
<updated>2015-08-14T23:55:54Z</updated>
<author>
<name>Stefan Koch</name>
<email>stefan.koch10@gmail.com</email>
</author>
<published>2015-08-08T09:32:52Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=de7718bd9c4d3db96991a98c2a0cb38258a04e47'/>
<id>urn:sha1:de7718bd9c4d3db96991a98c2a0cb38258a04e47</id>
<content type='text'>
Driver probings and interface claims get rejected
if an interface is not authorized.

Signed-off-by: Stefan Koch &lt;skoch@suse.de&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: fix coding style issue</title>
<updated>2015-07-22T21:55:21Z</updated>
<author>
<name>Kris Borer</name>
<email>kborer@gmail.com</email>
</author>
<published>2015-06-16T17:24:53Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=79a02744bc5a2993d6c5b8dd1a790f7ea12f4e0b'/>
<id>urn:sha1:79a02744bc5a2993d6c5b8dd1a790f7ea12f4e0b</id>
<content type='text'>
Fixed coding style issue: newline after declaration

Signed-off-by: Kris Borer &lt;kborer@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>USB: add flag for HCDs that can't receive wakeup requests (isp1760-hcd)</title>
<updated>2015-01-31T17:05:06Z</updated>
<author>
<name>Alan Stern</name>
<email>stern@rowland.harvard.edu</email>
</author>
<published>2015-01-29T20:05:04Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=074f9dd55f9cab1b82690ed7e44bcf38b9616ce0'/>
<id>urn:sha1:074f9dd55f9cab1b82690ed7e44bcf38b9616ce0</id>
<content type='text'>
Currently the USB stack assumes that all host controller drivers are
capable of receiving wakeup requests from downstream devices.
However, this isn't true for the isp1760-hcd driver, which means that
it isn't safe to do a runtime suspend of any device attached to a
root-hub port if the device requires wakeup.

This patch adds a "cant_recv_wakeups" flag to the usb_hcd structure
and sets the flag in isp1760-hcd.  The core is modified to prevent a
direct child of the root hub from being put into runtime suspend with
wakeup enabled if the flag is set.

Signed-off-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Tested-by: Nicolas Pitre &lt;nico@linaro.org&gt;
CC: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;greg@kroah.com&gt;
</content>
</entry>
<entry>
<title>USB: don't cancel queued resets when unbinding drivers</title>
<updated>2015-01-25T12:54:17Z</updated>
<author>
<name>Alan Stern</name>
<email>stern@rowland.harvard.edu</email>
</author>
<published>2015-01-21T19:02:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=524134d422316a59d5464ccbc12036bbe90c5563'/>
<id>urn:sha1:524134d422316a59d5464ccbc12036bbe90c5563</id>
<content type='text'>
The USB stack provides a mechanism for drivers to request an
asynchronous device reset (usb_queue_reset_device()).  The mechanism
uses a work item (reset_ws) embedded in the usb_interface structure
used by the driver, and the reset is carried out by a work queue
routine.

The asynchronous reset can race with driver unbinding.  When this
happens, we try to cancel the queued reset before unbinding the
driver, on the theory that the driver won't care about any resets once
it is unbound.

However, thanks to the fact that lockdep now tracks work queue
accesses, this can provoke a lockdep warning in situations where the
device reset causes another interface's driver to be unbound; see

	http://marc.info/?l=linux-usb&amp;m=141893165203776&amp;w=2

for an example.  The reason is that the work routine for reset_ws in
one interface calls cancel_queued_work() for the reset_ws in another
interface.  Lockdep thinks this might lead to a work routine trying to
cancel itself.  The simplest solution is not to cancel queued resets
when unbinding drivers.

This means we now need to acquire a reference to the usb_interface
when queuing a reset_ws work item and to drop the reference when the
work routine finishes.  We also need to make sure that the
usb_interface structure doesn't outlive its parent usb_device; this
means acquiring and dropping a reference when the interface is created
and destroyed.

In addition, cancelling a queued reset can fail (if the device is in
the middle of an earlier reset), and this can cause usb_reset_device()
to try to rebind an interface that has been deallocated (see
http://marc.info/?l=linux-usb&amp;m=142175717016628&amp;w=2 for details).
Acquiring the extra references prevents this failure.

Signed-off-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Reported-by: Russell King - ARM Linux &lt;linux@arm.linux.org.uk&gt;
Reported-by: Olivier Sobrie &lt;olivier@sobrie.be&gt;
Tested-by: Olivier Sobrie &lt;olivier@sobrie.be&gt;
Cc: stable &lt;stable@vger.kernel.org&gt; # 3.19
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>USB / PM: Drop CONFIG_PM_RUNTIME from the USB core</title>
<updated>2014-12-03T23:51:54Z</updated>
<author>
<name>Rafael J. Wysocki</name>
<email>rafael.j.wysocki@intel.com</email>
</author>
<published>2014-11-29T22:47:05Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ceb6c9c862c86423f41c1e20ecf8d454f837f519'/>
<id>urn:sha1:ceb6c9c862c86423f41c1e20ecf8d454f837f519</id>
<content type='text'>
After commit b2b49ccbdd54 (PM: Kconfig: Set PM_RUNTIME if PM_SLEEP is
selected) PM_RUNTIME is always set if PM is set, so quite a few
depend on CONFIG_PM (or even dropped in some cases).

Replace CONFIG_PM_RUNTIME with CONFIG_PM in the USB core code
and documentation.

Signed-off-by: Rafael J. Wysocki &lt;rafael.j.wysocki@intel.com&gt;
Acked-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Acked-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
