<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/usb/core/devio.c, branch v4.7</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.7</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v4.7'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2016-05-03T21:32:07Z</updated>
<entry>
<title>USB: usbfs: fix potential infoleak in devio</title>
<updated>2016-05-03T21:32:07Z</updated>
<author>
<name>Kangjie Lu</name>
<email>kangjielu@gmail.com</email>
</author>
<published>2016-05-03T20:32:16Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=681fef8380eb818c0b845fca5d2ab1dcbab114ee'/>
<id>urn:sha1:681fef8380eb818c0b845fca5d2ab1dcbab114ee</id>
<content type='text'>
The stack object “ci” has a total size of 8 bytes. Its last 3 bytes
are padding bytes which are not initialized and leaked to userland
via “copy_to_user”.

Signed-off-by: Kangjie Lu &lt;kjlu@gatech.edu&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: devio: declare usbdev_vm_ops as static</title>
<updated>2016-04-28T19:35:36Z</updated>
<author>
<name>Michele Curti</name>
<email>michele.curti@gmail.com</email>
</author>
<published>2016-04-27T19:23:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=10871c13608a624562e082196148f1dc4e37005e'/>
<id>urn:sha1:10871c13608a624562e082196148f1dc4e37005e</id>
<content type='text'>
usbdev_vm_ops is used in devio.c only, so declare it as static

Signed-off-by: Michele Curti &lt;michele.curti@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: devio: Add ioctl to disallow detaching kernel USB drivers.</title>
<updated>2016-03-05T20:05:01Z</updated>
<author>
<name>Reilly Grant</name>
<email>reillyg@chromium.org</email>
</author>
<published>2016-02-21T21:38:01Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d883f52e1f6d2eca8378e3795f333c1396943873'/>
<id>urn:sha1:d883f52e1f6d2eca8378e3795f333c1396943873</id>
<content type='text'>
The new USBDEVFS_DROP_PRIVILEGES ioctl allows a process to voluntarily
relinquish the ability to issue other ioctls that may interfere with
other processes and drivers that have claimed an interface on the
device.

This commit also includes a simple utility to be able to test the
ioctl, located at Documentation/usb/usbdevfs-drop-permissions.c

Example (with qemu-kvm's input device):

    $ lsusb
    ...
    Bus 001 Device 002: ID 0627:0001 Adomax Technology Co., Ltd

    $ usb-devices
    ...
    C:  #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=100mA
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=00 Prot=02 Driver=usbhid

    $ sudo ./usbdevfs-drop-permissions /dev/bus/usb/001/002
    OK: privileges dropped!
    Available options:
    [0] Exit now
    [1] Reset device. Should fail if device is in use
    [2] Claim 4 interfaces. Should succeed where not in use
    [3] Narrow interface permission mask
    Which option shall I run?: 1
    ERROR: USBDEVFS_RESET failed! (1 - Operation not permitted)
    Which test shall I run next?: 2
    ERROR claiming if 0 (1 - Operation not permitted)
    ERROR claiming if 1 (1 - Operation not permitted)
    ERROR claiming if 2 (1 - Operation not permitted)
    ERROR claiming if 3 (1 - Operation not permitted)
    Which test shall I run next?: 0

After unbinding usbhid:

    $ usb-devices
    ...
    I:  If#= 0 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=00 Prot=02 Driver=(none)

    $ sudo ./usbdevfs-drop-permissions /dev/bus/usb/001/002
    ...
    Which option shall I run?: 2
    OK: claimed if 0
    ERROR claiming if 1 (1 - Operation not permitted)
    ERROR claiming if 2 (1 - Operation not permitted)
    ERROR claiming if 3 (1 - Operation not permitted)
    Which test shall I run next?: 1
    OK: USBDEVFS_RESET succeeded
    Which test shall I run next?: 0

After unbinding usbhid and restricting the mask:

    $ sudo ./usbdevfs-drop-permissions /dev/bus/usb/001/002
    ...
    Which option shall I run?: 3
    Insert new mask: 0
    OK: privileges dropped!
    Which test shall I run next?: 2
    ERROR claiming if 0 (1 - Operation not permitted)
    ERROR claiming if 1 (1 - Operation not permitted)
    ERROR claiming if 2 (1 - Operation not permitted)
    ERROR claiming if 3 (1 - Operation not permitted)

Signed-off-by: Reilly Grant &lt;reillyg@chromium.org&gt;
Acked-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Signed-off-by: Emilio López &lt;emilio.lopez@collabora.co.uk&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>USB: Add support for usbfs zerocopy.</title>
<updated>2016-02-15T01:11:48Z</updated>
<author>
<name>Steinar H. Gunderson</name>
<email>sesse@google.com</email>
</author>
<published>2016-02-03T21:58:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=f7d34b445abc00e979b7cf36b9580ac3d1a47cd8'/>
<id>urn:sha1:f7d34b445abc00e979b7cf36b9580ac3d1a47cd8</id>
<content type='text'>
Add a new interface for userspace to preallocate memory that can be
used with usbfs. This gives two primary benefits:

 - Zerocopy; data no longer needs to be copied between the userspace
   and the kernel, but can instead be read directly by the driver from
   userspace's buffers. This works for all kinds of transfers (even if
   nonsensical for control and interrupt transfers); isochronous also
   no longer need to memset() the buffer to zero to avoid leaking kernel data.

 - Once the buffers are allocated, USB transfers can no longer fail due to
   memory fragmentation; previously, long-running programs could run into
   problems finding a large enough contiguous memory chunk, especially on
   embedded systems or at high rates.

Memory is allocated by using mmap() against the usbfs file descriptor,
and similarly deallocated by munmap(). Once memory has been allocated,
using it as pointers to a bulk or isochronous operation means you will
automatically get zerocopy behavior. Note that this also means you cannot
modify outgoing data until the transfer is complete. The same holds for
data on the same cache lines as incoming data; DMA modifying them at the
same time could lead to your changes being overwritten.

There's a new capability USBDEVFS_CAP_MMAP that userspace can query to see
if the running kernel supports this functionality, if just trying mmap() is
not acceptable.

Largely based on a patch by Markus Rechberger with some updates. The original
patch can be found at:

  http://sundtek.de/support/devio_mmap_v0.4.diff

Signed-off-by: Steinar H. Gunderson &lt;sesse@google.com&gt;
Signed-off-by: Markus Rechberger &lt;mrechberger@gmail.com&gt;
Acked-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>USB: core, devio: use to_usb_device</title>
<updated>2016-01-25T05:00:33Z</updated>
<author>
<name>Geliang Tang</name>
<email>geliangtang@163.com</email>
</author>
<published>2015-12-23T13:26:50Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=69ab55d7be6c3d69fa2e38f2a2bed4e91b9edf8d'/>
<id>urn:sha1:69ab55d7be6c3d69fa2e38f2a2bed4e91b9edf8d</id>
<content type='text'>
Use to_usb_device() instead of open-coding it.

Signed-off-by: Geliang Tang &lt;geliangtang@163.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: Use memdup_user to reuse the code</title>
<updated>2016-01-25T03:45:09Z</updated>
<author>
<name>Rahul Pathak</name>
<email>rpathak@visteon.com</email>
</author>
<published>2015-12-11T05:40:51Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=73a02d32458ecff5b6241e7e7bd6445f70400bad'/>
<id>urn:sha1:73a02d32458ecff5b6241e7e7bd6445f70400bad</id>
<content type='text'>
Fixing coccicheck warning which recommends to use memdup_user instead
to reimplement its code, using memdup_user simplifies the code

./drivers/usb/core/devio.c:1398:11-18: WARNING opportunity for memdup_user

Signed-off-by: Rahul Pathak &lt;rpathak@visteon.com&gt;
Acked-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>usb: core: devio.c: Removed unnecessary space</title>
<updated>2016-01-25T03:45:09Z</updated>
<author>
<name>Chase Metzger</name>
<email>chasemetzger15@gmail.com</email>
</author>
<published>2015-12-23T04:19:45Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=64f10edf0751727154e843e8bcf59fb659e579a2'/>
<id>urn:sha1:64f10edf0751727154e843e8bcf59fb659e579a2</id>
<content type='text'>
Removed an unnecessary space between a function name and arguments.

Signed-off-by: Chase Metzger &lt;chasemetzger15@gmail.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>Merge tag 'usb-4.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb</title>
<updated>2016-01-13T17:26:40Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2016-01-13T17:26:40Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=237f38c3b3ab08eadecc89b7c9647b1cdb996bbe'/>
<id>urn:sha1:237f38c3b3ab08eadecc89b7c9647b1cdb996bbe</id>
<content type='text'>
Pull USB updates from Greg KH:
 "Here is the big USB drivers update for 4.5-rc1.

  Lots of gadget driver updates and fixes, like usual, and a mix of
  other USB driver updates as well.  Full details in the shortlog.  All
  of these have been in linux-next for a while"

* tag 'usb-4.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (191 commits)
  MAINTAINERS: change my email address
  USB: usbmon: remove assignment from IS_ERR argument
  USB: mxu11x0: drop redundant function name from error messages
  USB: mxu11x0: fix debug-message typos
  USB: mxu11x0: rename usb-serial driver
  USB: mxu11x0: fix modem-control handling on B0-transitions
  USB: mxu11x0: fix memory leak on firmware download
  USB: mxu11x0: fix memory leak in port-probe error path
  USB: serial: add Moxa UPORT 11x0 driver
  USB: cp210x: add ID for ELV Marble Sound Board 1
  usb: chipidea: otg: use usb autosuspend to suspend bus for HNP
  usb: chipidea: host: set host to be null after hcd is freed
  usb: chipidea: removing of_find_property
  usb: chipidea: implement platform shutdown callback
  usb: chipidea: clean up CONFIG_USB_CHIPIDEA_DEBUG reference
  usb: chipidea: delete static debug support
  usb: chipidea: support debugfs without CONFIG_USB_CHIPIDEA_DEBUG
  usb: chipidea: udc: improve error handling on _hardware_enqueue
  usb: chipidea: udc: _ep_queue and _hw_queue cleanup
  usb: dwc3: of-simple: fix build warning on !PM
  ...
</content>
</entry>
<entry>
<title>new helpers: no_seek_end_llseek{,_size}()</title>
<updated>2015-12-23T15:41:31Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2015-12-06T03:04:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=b25472f9b96159cc0b9b7ed449448805973cd789'/>
<id>urn:sha1:b25472f9b96159cc0b9b7ed449448805973cd789</id>
<content type='text'>
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>USB: add usbfs snooping for REAP and DISCARD</title>
<updated>2015-12-01T18:44:19Z</updated>
<author>
<name>Alan Stern</name>
<email>stern@rowland.harvard.edu</email>
</author>
<published>2015-11-20T18:53:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a016a816bb96088ce4cd0ec890e256e4a63dfb47'/>
<id>urn:sha1:a016a816bb96088ce4cd0ec890e256e4a63dfb47</id>
<content type='text'>
This patch improves the usbfs_snoop debugging facility by adding
messages for a couple of significant events which, up to now, have not
been logged.  The events are reaping and discarding (i.e.,
cancelling) an URB.  The debugging messages include the userspace
address of the URB being reaped or discarded.

The reaping messages have to be added in four places, in order to
handle blocking and non-blocking reaps in both normal and 32-bit
compatibility mode.

Signed-off-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
