Commit Graph

14946 Commits

Author SHA1 Message Date
Johan Hovold
cbb4be652d USB: whiteheat: fix potential null-deref at probe
Fix potential null-pointer dereference at probe by making sure that the
required endpoints are present.

The whiteheat driver assumes there are at least five pairs of bulk
endpoints, of which the final pair is used for the "command port". An
attempt to bind to an interface with fewer bulk endpoints would
currently lead to an oops.

Fixes CVE-2015-5257.

Reported-by: Moein Ghasemzadeh <moein@istuary.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-23 12:15:19 -07:00
Mathias Nyman
cc8e4fc0c3 xhci: init command timeout timer earlier to avoid deleting it uninitialized
Don't check if timer is running with a timer_pending() before
deleting it with del_timer_sync(), this defies the whole point of
the sync part and can cause a possible race.

Instead we just want to make sure the timer is initialized early enough
before we have a chance to delete it.

Cc: <stable@vger.kernel.org>
Reported-by: Oliver Neukum <oneukum@suse.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-21 22:50:45 -07:00
Mathias Nyman
dca7794539 xhci: change xhci 1.0 only restrictions to support xhci 1.1
Some changes between xhci 0.96 and xhci 1.0 specifications forced us to
check the hci version in code, some of these checks were implemented as
hci_version == 1.0, which will not work with new xhci 1.1 controllers.

xhci 1.1 behaves similar to xhci 1.0 in these cases, so change these
checks to hci_version >= 1.0

Cc: <stable@vger.kernel.org>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-21 22:50:44 -07:00
Roger Quadros
448116bfa8 usb: xhci: exit early in xhci_setup_device() if we're halted or dying
During quick plug/removal of OTG adapter during dual-role testing
it can happen that xhci_alloc_device() is called for the newly
detected device after the DRD library has called xhci_stop to
remove the HCD.

If that is the case, just fail early to prevent the following warning.

[  154.732649] hub 4-0:1.0: USB hub found
[  154.742204] hub 4-0:1.0: 1 port detected
[  154.824458] hub 3-0:1.0: state 7 ports 1 chg 0002 evt 0000
[  154.854609] hub 4-0:1.0: state 7 ports 1 chg 0000 evt 0000
[  154.944430] usb 3-1: new high-speed USB device number 2 using xhci-hcd
[  154.951009] xhci-hcd xhci-hcd.0.auto: xhci_setup_device
[  155.038191] xhci-hcd xhci-hcd.0.auto: remove, state 4
[  155.043315] usb usb4: USB disconnect, device number 1
[  155.055270] xhci-hcd xhci-hcd.0.auto: xhci_stop
[  155.060094] xhci-hcd xhci-hcd.0.auto: USB bus 4 deregistered
[  155.066576] xhci-hcd xhci-hcd.0.auto: remove, state 1
[  155.071710] usb usb3: USB disconnect, device number 1
[  155.077124] xhci-hcd xhci-hcd.0.auto: xhci_setup_device
[  155.082389] ------------[ cut here ]------------
[  155.087690] WARNING: CPU: 0 PID: 72 at drivers/usb/host/xhci.c:3800 xhci_setup_device+0x410/0x484 [xhci_hcd]()
[  155.097861] Modules linked in: sd_mod usb_storage scsi_mod usb_f_ss_lb g_zero libcomposite ipv6 xhci_plat_hcd xhci_hcd usbcore dwc3 udc_core evdev ti_am335x_adc joydev kfifo_buf industrialio snd_soc_simple_cc
[  155.146734] CPU: 0 PID: 72 Comm: kworker/0:3 Tainted: G        W       4.1.4-00834-gcd9380b-dirty #50
[  155.156073] Hardware name: Generic AM43 (Flattened Device Tree)
[  155.162117] Workqueue: usb_hub_wq hub_event [usbcore]
[  155.167249] Backtrace:
[  155.169751] [<c0012af0>] (dump_backtrace) from [<c0012c8c>] (show_stack+0x18/0x1c)
[  155.177390]  r6:c089d4a4 r5:ffffffff r4:00000000 r3:ee46c000
[  155.183137] [<c0012c74>] (show_stack) from [<c05f7c14>] (dump_stack+0x84/0xd0)
[  155.190446] [<c05f7b90>] (dump_stack) from [<c00439ac>] (warn_slowpath_common+0x80/0xbc)
[  155.198605]  r7:00000009 r6:00000ed8 r5:bf27eb70 r4:00000000
[  155.204348] [<c004392c>] (warn_slowpath_common) from [<c0043a0c>] (warn_slowpath_null+0x24/0x2c)
[  155.213202]  r8:ee49f000 r7:ee7c0004 r6:00000000 r5:ee7c0158 r4:ee7c0000
[  155.220051] [<c00439e8>] (warn_slowpath_null) from [<bf27eb70>] (xhci_setup_device+0x410/0x484 [xhci_hcd])
[  155.229816] [<bf27e760>] (xhci_setup_device [xhci_hcd]) from [<bf27ec10>] (xhci_address_device+0x14/0x18 [xhci_hcd])
[  155.240415]  r10:ee598200 r9:00000001 r8:00000002 r7:00000001 r6:00000003 r5:00000002
[  155.248363]  r4:ee49f000
[  155.250978] [<bf27ebfc>] (xhci_address_device [xhci_hcd]) from [<bf20cb94>] (hub_port_init+0x1b8/0xa9c [usbcore])
[  155.261403] [<bf20c9dc>] (hub_port_init [usbcore]) from [<bf2101e0>] (hub_event+0x738/0x1020 [usbcore])
[  155.270874]  r10:ee598200 r9:ee7c0000 r8:ee7c0038 r7:ee518800 r6:ee49f000 r5:00000001
[  155.278822]  r4:00000000
[  155.281426] [<bf20faa8>] (hub_event [usbcore]) from [<c005754c>] (process_one_work+0x128/0x340)
[  155.290196]  r10:00000000 r9:00000003 r8:00000000 r7:fedfa000 r6:eeec5400 r5:ee598314
[  155.298151]  r4:ee434380
[  155.300718] [<c0057424>] (process_one_work) from [<c00578f8>] (worker_thread+0x158/0x49c)
[  155.308963]  r10:ee434380 r9:00000003 r8:eeec5400 r7:00000008 r6:ee434398 r5:eeec5400
[  155.316913]  r4:eeec5414
[  155.319482] [<c00577a0>] (worker_thread) from [<c005cc40>] (kthread+0xdc/0xf8)
[  155.326765]  r10:00000000 r9:00000000 r8:00000000 r7:c00577a0 r6:ee434380 r5:ee4441c0
[  155.334713]  r4:00000000 r3:00000000
[  155.338341] [<c005cb64>] (kthread) from [<c000fc08>] (ret_from_fork+0x14/0x2c)
[  155.345626]  r7:00000000 r6:00000000 r5:c005cb64 r4:ee4441c0
[  155.356108] ---[ end trace a58d34c223b190e6 ]---
[  155.360783] xhci-hcd xhci-hcd.0.auto: Virt dev invalid for slot_id 0x1!
[  155.574404] xhci-hcd xhci-hcd.0.auto: xhci_setup_device
[  155.579667] ------------[ cut here ]------------

Cc: <stable@vger.kernel.org>
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-21 22:50:44 -07:00
Roger Quadros
8c24d6d7b0 usb: xhci: stop everything on the first call to xhci_stop
xhci_stop will be called twice, once for the shared hcd
and again for the primary hcd.

We stop the XHCI controller in any case so clean up
everything on the first call else we can timeout
waiting for pending requests to complete.

Cc: <stable@vger.kernel.org>
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-21 22:50:44 -07:00
Roger Quadros
e5bfeab0ad usb: xhci: Clear XHCI_STATE_DYING on start
For whatever reason if XHCI died in the previous instant
then it will never recover on the next xhci_start unless we
clear the DYING flag.

Cc: <stable@vger.kernel.org>
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-21 22:48:53 -07:00
Roger Quadros
85ac90f895 usb: xhci: lock mutex on xhci_stop
Else it races with xhci_setup_device

Cc: <stable@vger.kernel.org>
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-21 22:48:53 -07:00
Tomer Barletz
2b7627b73e xhci: Move xhci_pme_quirk() behind #ifdef CONFIG_PM
xhci_pme_quirk() is only used when CONFIG_PM is defined.
Compiling a kernel without PM complains about this function

[reworded commit message -Mathias]
Cc: <stable@vger.kernel.org>
Signed-off-by: Tomer Barletz <barletz@gmail.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-21 22:48:53 -07:00
Mathias Nyman
a6809ffd16 xhci: give command abortion one more chance before killing xhci
We want to give the command abortion an additional try to stop
the command ring before we completely hose xhci.

Cc: <stable@vger.kernel.org>
Tested-by: Vincent Pelletier <plr.vincent@gmail.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-21 22:48:53 -07:00
Mathias Nyman
ff30cbc8da usb: Use the USB_SS_MULT() macro to get the burst multiplier.
Bits 1:0 of the bmAttributes are used for the burst multiplier.
The rest of the bits used to be reserved (zero), but USB3.1 takes bit 7
into use.

Use the existing USB_SS_MULT() macro instead to make sure the mult value
and hence max packet calculations are correct for USB3.1 devices.

Note that burst multiplier in bmAttributes is zero based and that
the USB_SS_MULT() macro adds one.

Cc: <stable@vger.kernel.org>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-09-21 22:48:53 -07:00
Greg Kroah-Hartman
01f4fd2a4f usb: fixes for v4.3-rc3
Here's the second pull request for current -rc cycle.
 
 A few fixes on dummy_hcd which have been around for
 longer than they should be.
 
 MUSB got a couple fixes, the most important of which
 is a fix to DMA channel teardown on AM335x devices.
 
 And DWC3 got a minor fix for when using RT-enabled
 kernels.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJWAF8tAAoJEIaOsuA1yqREmlcQALFf3vheeMxu095CX1YKhuGK
 ktqRaSg/3Uwq3h6M1PJ8nf/n/oJQFbOJvMgZlKU5JgJy0fnyQIah1sUOkQCcisHM
 EWvfzAfa12yMX5Z9vCQbRksjkPg4ckte8vDhqCturNocYUPqid4KntU7G+8GTtqR
 OvnjN35foEkT01y2SW2JK/l6ZGoqfQ9etgVgfs+2FzEBTfjtT1Yi9uovi6V/pjCF
 h3KAhR340EK7jUg/+p6wFBDgvRS9FenuV5BebT+mldWMWGfAMwLNB06v2fbOZ+Jh
 +zAT/kq/l0gIRER6MIdR8hqzIzIWI4bmD/huCmi55auK3pP5zMwRvl2vifp2feVQ
 FI4WbL/44Tsr+N/PlB1iG82iI4XmYrwv72NWn9K0vbY9vzS7LSvoS9COpeFYTaAE
 6+k/sB5Sw6eYPeeM4kdjKD+XfWpki2b9jxsgYKo01et6MvDoOwEvtGyCeBohYUF1
 WwJulAPk/8cmZiI1JL4Rf8CDV+fOB2DHvVtKcnpQjlvdDud2sl6bIdT/zdceCidJ
 F6+bu9JRuM2MFNbJChut1iJOiecoJMXeII00IDynCmQtg1fyDTS2+Un725rSqDxD
 /+PXZqXFqpW8TBrToBPJGx0uiwBJciDXUN8hX/O+E6S3wmGeJYDHKspPQUA2iJvK
 BSbCrIDsQEb6m3NS7bR8
 =Lyn+
 -----END PGP SIGNATURE-----

Merge tag 'fixes-for-v4.3-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb into usb-linus

Felipe writes:

usb: fixes for v4.3-rc3

Here's the second pull request for current -rc cycle.

A few fixes on dummy_hcd which have been around for
longer than they should be.

MUSB got a couple fixes, the most important of which
is a fix to DMA channel teardown on AM335x devices.

And DWC3 got a minor fix for when using RT-enabled
kernels.
2015-09-21 22:21:31 -07:00
Roger Quadros
a66c275b3d usb: dwc3: gadget: Fix BUG in RT config
Using spin_lock() in hard irq handler is pointless
and causes a BUG() in RT (real-time) configuration
so get rid of it.

The reason it's pointless is because the driver is
basically accessing register which is, anyways,
atomic.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-21 14:42:36 -05:00
Bin Liu
b431ba8803 usb: musb: fix cppi channel teardown for isoch transfer
After a few iterations of start/stop UVC camera streaming, the streaming
stops.

This patch adds 250us delay in the cppi channel abort path to let cppi
drain properly.

Using 50us delay seems to be too aggressive, some webcams are still
broken. 250us is the original value used in TI 3.2 kernel.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-21 14:42:36 -05:00
Javier Martinez Canillas
8fb7ab5043 usb: phy: isp1301: Export I2C module alias information
The I2C core always reports the MODALIAS uevent as "i2c:<client name"
regardless if the device was registered using OF or platform code so
So the driver needs to export the I2C table and this be built into
the module or udev won't have the necessary information to auto load
the module when the device is added.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-21 14:42:36 -05:00
Julia Lawall
51b91b7e6c usb: gadget: drop null test before destroy functions
Remove unneeded NULL test.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@ expression x; @@
-if (x != NULL)
  \(kmem_cache_destroy\|mempool_destroy\|dma_pool_destroy\)(x);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-21 14:42:36 -05:00
Igor Kotrasinski
9a9ce1dfae usb: gadget: dummy_hcd: in transfer(), return data sent, not limit
dummy_timer uses transfer() to update transfer limit. However,
limit passed to dummy_timer changes depending on transfer type,
so the actual limit is overwritten.

This can cause unpredictably slow / fast bulk transfers when
coupled with control / interrupt transfers.

Fix by returning actual amount of data sent in transfer() and
substracting from total.

Signed-off-by: Igor Kotrasinski <i.kotrasinsk@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-21 14:42:36 -05:00
Igor Kotrasinski
e42bd6a54b usb: gadget: dummy_hcd: fix rescan logic for transfer
transfer() schedules a rescan for transfers larger than
maxpacket, which is wrong for transfers that are multiples
of maxpacket.

Rewrite to fix and clarify packet multiple / remainder
transfer logic.

Signed-off-by: Igor Kotrasinski <i.kotrasinsk@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-21 14:42:36 -05:00
Igor Kotrasinski
5dda5be9d5 usb: gadget: dummy_hcd: fix unneeded else-if condition
We already know at this point that to_host is false.

Signed-off-by: Igor Kotrasinski <i.kotrasinsk@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-21 14:42:35 -05:00
Igor Kotrasinski
21c3ee9386 usb: gadget: dummy_hcd: emulate sending zlp in packet logic
currently, when a zlp flag is set and an urb/usb_request
buffer is filled without a short packet, transfer() leaves
its status at -EINPROGRESS and does not rescan for short
packet.

In a scenario where ep.maxpacket bytes are copied,
URB_ZERO_PACKET is set, urb buffer is filled and usb_request
buffer is not, transfer() returns with an urb with
-EINPROGRESS status, which dummy_hcd treats as incomplete
transfer.

Check for zlp and rescan appropriately.

Signed-off-by: Igor Kotrasinski <i.kotrasinsk@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-21 14:42:35 -05:00
Bin Liu
b8239dcc03 usb: musb: dsps: fix polling in device-only mode
Fix the regression caused by commit ad78c91860 ("usb: musb: dsps: just
start polling already") which causes polling the ID pin status even in
device-only mode.

Fixes: ad78c91860 ("usb: musb: dsps: just start polling already")
Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-21 14:42:35 -05:00
Sylvain Rochet
cf261fd1a4 usb: gadget: atmel_usba_udc: add ep capabilities support on device tree binding
The recently added endpoint capabilities flags verification breaks Atmel
USBA because the endpoint configuration was only added when the driver
is bound using the legacy pdata interface.

Convert endpoint configuration to new capabilities model when driver is
bound to a device tree as well.

Signed-off-by: Sylvain Rochet <sylvain.rochet@finsecur.com>
Fixes: 47bef38651 ("usb: gadget: atmel_usba_udc: add ep capabilities support")
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-21 14:42:35 -05:00
Greg Kroah-Hartman
ea9346514e USB Chipidea fixes for v4.3-rc2
- Fix the stall implementation
 - Fix device mode transfer at zynq platform
 - other small fixes
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJV+8GAAAoJEEhZKYFQ1nG79FMH/2dAYwuA4S9OgQq2rGZnaZnM
 MaWFKF5Q/4mLdVd9cnJDL1B/GVq0yT50n2P8h4/pjHLGetmo6iMIDgjsQXcO6JTa
 vyWTggq/2eCQDJk/dBMbQlyzyavrGT4SY4PYbMJ/ggZEm9UmI/ONjBWlExnLkiqp
 Yjk7lJ/JH3Du3cgZ3nePJoB7r0ETbJnxZf3H1AgU3//n74xcgRz48HeBQxMHXqj5
 Hy9CDbsrKcyhigx3liIPr1zFdWs0P5km199PrWTkyKVmjAjIxU7mlimUbM2RuPwo
 IVOcce5Z6OWObfmNiZtrc2ZcxbAfvUOeT6OkEmyhAeq1fvVtdEO3Wh8suWZGaSg=
 =O6FV
 -----END PGP SIGNATURE-----

Merge tag 'usb-ci-v4.3-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/peter.chen/usb into usb-linus

Peter writes:

USB Chipidea fixes for v4.3-rc2

- Fix the stall implementation
- Fix device mode transfer at zynq platform
- other small fixes
2015-09-18 09:56:08 -07:00
Greg Kroah-Hartman
74a093918b USB-serial fixes for v4.3-rc2
Just some new ZTE device IDs.
 
 Signed-off-by: Johan Hovold <johan@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJV+uRrAAoJEEEN5E/e4bSV0pMP/iX1nPVHp3Q5ROWuyGTDL0I2
 sul191jXkDZ/iHA2hnwC1vpaLqtguCfQwL+v0iZnek5OJiNcUcvw/Ykwu5Uxycul
 yNUpceUVFppI99XabpC2bhc+Uy3sBqp4+n2mzdOZxwJM6HIaiTzE/Wnnn/MCm67m
 r7NyvY7lJxrTl4hUCI9kqo89f30NVX0fFnfLojLex85v5soOjLNYTrvG1ysrUlu0
 cJAH5fM0Hn642idIpT1Ogq/YXPrd+jFN3aFoFAZuT76+ogwYAMmbMR4lYLMs4sNd
 wPIlttphO+pMvCPoKIviwBB/fun61PGECDsOTlXyw6tjqFlm8bYiaIePrRgV4LSZ
 duqOJpdzf6Q15SZHWrJi4ZJG1rDs1xE78MMzIoa2xmw4cuwykAp/QAJBSMriQ+VW
 1iOjYWlXmQPM+m3flPW6DVSIdQhjLlY3L6Xqw9YlXsEz6DFdjSkeXYP2wDv/Tfy3
 B2NTeL5erPfbus+D2PZuu5EDQPvgV9yLt12ZQ1eNIV64g+dFk5w3/KrV+f73J34+
 mfnbS27UtaQIcACDLOvmwsEI8+4QSGRflgQUhxD8lMxgcBL4+2aed4JaV/PBE+BH
 QoaS0kzjaL0lXYwqwTxHOme40bQg2d5wtMR209S9uuwNcBLD9xdgGaRKdtfh8G/d
 KPs48njOlAvTJheTta6W
 =/StG
 -----END PGP SIGNATURE-----

Merge tag 'usb-serial-4.3-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial into usb-linus

Johan writes:

USB-serial fixes for v4.3-rc2

Just some new ZTE device IDs.

Signed-off-by: Johan Hovold <johan@kernel.org>
2015-09-17 09:39:39 -07:00
Li Jun
8315b77d72 usb: chipidea: imx: fix a typo for imx6sx
Use imx6sx instead of imx6sl's platform flags for imx6sx.

Fixes: e14db48dfc ("usb: chipidea: imx: add runtime power management support")
Cc: <stable@vger.kernel.org> # v4.1+
Signed-off-by: Li Jun <jun.li@freescale.com>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
2015-09-16 13:45:11 +08:00
Nathan Sullivan
84bc70f94d usb: chipidea: add xilinx zynq platform data
Due to having hardware tx buffers less than 512 bytes in size, streaming
must be enabled on the Zynq for the udc to work at all.  Add platform data
specific to the Zynq udc, which does not set the CI_HDRC_DISABLE_STREAMING
flag.

Based on a patch by the same name from the Xilinx vendor tree.

Signed-off-by: Nathan Sullivan <nathan.sullivan@ni.com>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
2015-09-15 16:08:49 +08:00
Peter Chen
56ffa1d154 usb: chipidea: udc: using the correct stall implementation
According to spec, there are functional and protocol stalls.

For functional stall, it is for bulk and interrupt endpoints,
below are cases for it:
- Host sends SET_FEATURE request for Set-Halt, the udc driver
needs to set stall, and return true unconditionally.
- The gadget driver may call usb_ep_set_halt to stall certain
endpoints, if there is a transfer in pending, the udc driver
should not set stall, and return -EAGAIN accordingly.
These two kinds of stall need to be cleared by host using CLEAR_FEATURE
request (Clear-Halt).

For protocol stall, it is for control endpoint, this stall will
be set if the control request has failed. This stall will be
cleared by next setup request (hardware will do it).

It fixed usbtest (drivers/usb/misc/usbtest.c) Test 13 "set/clear halt"
test failure, meanwhile, this change has been verified by
USB2 CV Compliance Test and MSC Tests.

Cc: <stable@vger.kernel.org> #3.10+
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: Felipe Balbi <balbi@ti.com>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
2015-09-15 16:08:28 +08:00
Roger Quadros
762982db33 usb: phy: phy-generic: Fix reset behaviour on legacy boot
The gpio-desc migration done in v4.0 caused a regression
with legacy boots due to reversed reset logic.
e.g. omap3-beagle USB host breaks on legacy boot.

Request the reset GPIO with GPIOF_ACTIVE_LOW flag so that
it matches the driver logic and pin behaviour.

Fixes: e9f2cefb0c ("usb: phy: generic: migrate to gpio_desc")
Cc: <stable@vger.kernel.org> # 4.0+
Tested-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-14 10:15:08 -05:00
Luis de Bethencourt
523d5daf86 usb: musb: ux500: Fix module autoload for OF platform driver
This platform driver has a OF device ID table but the OF module
alias information is not created so module autoloading won't work.

Signed-off-by: Luis de Bethencourt <luis@debethencourt.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-14 10:14:54 -05:00
Pascal Huerst
6fc6f4b87c usb: musb: Disable interrupts on suspend, enable them on resume
In certain situations, an interrupt triggers on resume, before musb_start()
has been called. This has been observed to cause enumeration issues after
suspend/resume cycles with AM335x.

Signed-off-by: Pascal Huerst <pascal.huerst@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-14 10:14:53 -05:00
Alexey Khoroshilov
6527cc2776 usb: gadget: amd5536udc: fix error handling in udc_pci_probe()
If a failure happens early in udc_pci_probe(), error handling code
just kfree(dev) and returns. The patch adds proper resource
deallocations in udc_pci_probe() itself,
since udc_pci_remove() is not suitabe to be called so early
in initialization process.

By the way, iounmap(dev->regs) is replaced by iounmap(dev->virt_addr)
in udc_pci_remove() for clarity.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-14 10:14:51 -05:00
Randy Dunlap
88ccdbd5fc usb: phy: fix phy-qcom-8x16-usb build
Fix build errors that happen when USB_QCOM_8X16_PHY=y and EXTCON=m:

drivers/built-in.o: In function `phy_8x16_init':
phy-qcom-8x16-usb.c:(.text+0x86ef4): undefined reference to `extcon_get_cable_state'
drivers/built-in.o: In function `phy_8x16_probe':
phy-qcom-8x16-usb.c:(.text+0x870bf): undefined reference to `extcon_get_edev_by_phandle'
phy-qcom-8x16-usb.c:(.text+0x87133): undefined reference to `extcon_register_interest'
phy-qcom-8x16-usb.c:(.text+0x87151): undefined reference to `extcon_unregister_interest'
drivers/built-in.o: In function `phy_8x16_remove':
phy-qcom-8x16-usb.c:(.text+0x872ec): undefined reference to `extcon_unregister_interest'

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Felipe Balbi <balbi@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-14 10:14:49 -05:00
Bin Liu
40af177efc usb: musb: ensure in peripheral mode when checking session
The change ensures otg is not in a A- state when checking for VBUS in
peripheral mode.

musb_start() where VBUS checking is in can be called in many situations.
One example is in babble recovery routine, in which otg is transitioning
from A-HOST to A-WAIT-BCON, but VBUS discharge takes time, so
musb->is_active could be set to 1 due to this improper checking, then it
causes musb_bus_suspend() failed which leads to warning log message
flooding.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-14 10:14:48 -05:00
Felipe Balbi
e2ae0692bf usb: dwc3: omap: enable irqs lately
If we enable IRQs before requesting our
extcon device, we might fall into a situation
where and IRQ fires before we're ready to
handle it.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-14 09:51:58 -05:00
Robert Baldyga
e4c1b1ba7f usb: gadget: fix possible regression introduced with ep->claimed
This patch fixes possible regression introduced by
patch reworking endpoint claiming mechanism. It restores
setring ep->driver_data to NULL in usb_ep_autoconfig_reset(),
which was removed by patch commit cc476b42a3.

Fixes: cc476b42a3 ("usb: gadget: encapsulate endpoint
	claiming mechanism")
Reported-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2015-09-14 09:51:50 -05:00
Liu.Zhao
19ab6bc567 USB: option: add ZTE PIDs
This is intended to add ZTE device PIDs on kernel.

Signed-off-by: Liu.Zhao <lzsos369@163.com>
Cc: stable <stable@vger.kernel.org>
[johan: sort the new entries ]
Signed-off-by: Johan Hovold <johan@kernel.org>
2015-09-14 09:56:41 +02:00
Linus Torvalds
089b669506 Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial
Pull trivial tree updates from Jiri Kosina:
 "The usual stuff from trivial tree for 4.3 (kerneldoc updates, printk()
  fixes, Documentation and MAINTAINERS updates)"

* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (28 commits)
  MAINTAINERS: update my e-mail address
  mod_devicetable: add space before */
  scsi: a100u2w: trivial typo in printk
  i2c: Fix typo in i2c-bfin-twi.c
  treewide: fix typos in comment blocks
  Doc: fix trivial typo in SubmittingPatches
  proportions: Spelling s/consitent/consistent/
  dm: Spelling s/consitent/consistent/
  aic7xxx: Fix typo in error message
  pcmcia: Fix typo in locking documentation
  scsi/arcmsr: Fix typos in error log
  drm/nouveau/gr: Fix typo in nv10.c
  [SCSI] Fix printk typos in drivers/scsi
  staging: comedi: Grammar s/Enable support a/Enable support for a/
  Btrfs: Spelling s/consitent/consistent/
  README: GTK+ is a acronym
  ASoC: omap: Fix typo in config option description
  mm: tlb.c: Fix error message
  ntfs: super.c: Fix error log
  fix typo in Documentation/SubmittingPatches
  ...
2015-09-01 18:46:42 -07:00
David Ward
44840dec61 USB: qcserial: add HP lt4111 LTE/EV-DO/HSPA+ Gobi 4G Module
This is an HP-branded Sierra Wireless EM7355:
https://bugzilla.redhat.com/show_bug.cgi?id=1223646#c2

Signed-off-by: David Ward <david.ward@ll.mit.edu>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-18 10:07:40 -07:00
Matthijs Kooijman
1fb8dc3638 USB: ftdi_sio: Added custom PID for CustomWare products
CustomWare uses the FTDI VID with custom PIDs for their ShipModul MiniPlex
products.

Signed-off-by: Matthijs Kooijman <matthijs@stdin.nl>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-18 10:07:40 -07:00
Johan Hovold
d2958d1b8f USB: usb_wwan: silence read errors on disconnect
Silence read-urb resubmission errors when the device is going away.

Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-18 10:07:10 -07:00
Johan Hovold
9257f1daa8 USB: option: silence interrupt errors
Avoid spamming the logs (e.g. with -EPROTO errors) when attempting to
resubmit the interrupt urb while a disconnect of an in-use device is
being processed.

Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-18 10:07:09 -07:00
Philipp Hachtmann
8ae25a355b USB: symbolserial: Correct transferred data size
The scanner (here DS3508) always returns 64 bytes per urb buffer. The first
byte indicates the data length used in the current buffer. There even was
a comment describing this. But the comment also said that we'll send
everything in the buffer to the tty layer. That means sending the actual
barcode data and lots of trailing zeroes. This patch lets the driver only
send the real data.

Signed-off-by: Philipp Hachtmann <hachti@hachti.de>
Acked-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-18 10:06:22 -07:00
Philipp Hachtmann
951d3793bb USB: symbolserial: Use usb_get_serial_port_data
The driver used usb_get_serial_data(port->serial) which compiled but resulted
in a NULL pointer being returned (and subsequently used). I did not go deeper
into this but I guess this is a regression.

Signed-off-by: Philipp Hachtmann <hachti@hachti.de>
Fixes: a85796ee51 ("USB: symbolserial: move private-data allocation to
port_probe")
Cc: stable <stable@vger.kernel.org>     # v3.10
Acked-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-18 10:06:22 -07:00
Peter Chen
a0c9d0defc usb: misc: usbtest: format max packet size for iso transfer
The current code prints all wMaxPacketSize content at endpoint
descriptor, if there is a high speed, high bandwidth endpoint,
it may confuse the users, eg, if there are 3 transactions during
microframe, it will print "wMaxPacket 1400" for packet content.
This commit splits wMaxpacketSize and transaction numbers for
output messages.

Signed-off-by: Peter Chen <peter.chen@freescale.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-18 10:05:23 -07:00
Peter Chen
0521cfd06e usb: host: ehci-sys: delete useless bus_to_hcd conversion
The ehci platform device's drvdata is the pointer of struct usb_hcd
already, so we doesn't need to call bus_to_hcd conversion again.

Cc: <stable@vger.kernel.org>
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-18 10:05:23 -07:00
Greg Kroah-Hartman
12e1a6a0f1 Revert "usb: interface authorization: Introduces the default interface authorization"
This reverts commit 1d958bef45 as the
signed-off-by address is invalid.

Cc: Stefan Koch <stefan.koch10@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-18 09:58:45 -07:00
Greg Kroah-Hartman
8c2ea97a3a Revert "usb: interface authorization: Control interface probing and claiming"
This reverts commit de7718bd9c as the
signed-off-by address is invalid.

Cc: Stefan Koch <stefan.koch10@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-18 09:58:26 -07:00
Greg Kroah-Hartman
5651440e45 Revert "usb: interface authorization: Introduces the USB interface authorization"
This reverts commit ef0909c50f as the
signed-off-by address is invalid.

Cc: Stefan Koch <stefan.koch10@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-18 09:58:04 -07:00
Greg Kroah-Hartman
4d924d7a81 Revert "usb: interface authorization: SysFS part of USB interface authorization"
This reverts commit 187b3d75bb as the
signed-off-by address is invalid.

Cc: Stefan Koch <stefan.koch10@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-18 09:57:43 -07:00
Greg Kroah-Hartman
a1b93ab715 Revert "usb: interface authorization: Use a flag for the default device authorization"
This reverts commit 3cf1fc8065 as the
signed-off-by address is invalid.

Cc: Stefan Koch <stefan.koch10@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-18 09:56:04 -07:00
Greg Kroah-Hartman
02dc2723f2 USB-serial updates for v4.3-rc1
Here's a fix for a long-standing issue with the pl2303 divisor
 calculations that affects some non-standard baudrates that were enabled
 in v3.18.
 
 Adding support for newer Edgeport devices and firmware required changes
 to the io_ti driver and also exposed some issues with the driver's
 current firmware handling.
 
 Included is also a URL comment-typo fix.
 
 Signed-off-by: Johan Hovold <johan@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABAgAGBQJV0a5IAAoJEEEN5E/e4bSVcesP/1eS4izHJkiBvkGmn4680nI3
 Ejtcpe6Q+QvGZDDw3XCRp0dsg6JsKmROHIuzrO1LaHKAnYOVO0RpbeCSgcWnMGpa
 A3SOdKY3CzWSaHkCpHbPg4iRErQcPnGixKUsdgLX4ENnVgJc6Qo/ityQfqh9EPfZ
 oQVvMM1b5gU5+b906DQuRkAbpzvGVy5NAA5MKPMLEmy3tJpzzrb/6ibCZUpj+DCO
 nm3MFbqzhkmQKGBxcqBfzlYt449Yu/tkFO5LEb743awaAcARSvwIaLDo60ehVicT
 9SaUMjj0l3hzfctOtJI1PhZSaP7DDs9/D4Gg0EZPUzTOAFuA+aDby2PSxBdbemyR
 cHSdi0xCBv759pLg841mKBFh/nHWlQjfg9JDyCLt/3GAA1bPp1Xxcoke2TgwSfLF
 nz3/R3nEqkprJZtT/T0kAQPFHufNn0pZmlRCup2BXm1PUztFCkMv1bQkDI9cULYK
 ji2q82SoD35tcrDTsJu64qzgUdQafRKROuxQYJY4ydjX+uaIqiUQlYpBSCiRgFfD
 OOHTcOr1xVqheMB/JLWWya190oF+MooGvynqS8rFsUEUaLaaH93QPHULnw00cyUP
 aGzRqCdmcEJvO/livEPL21ohRXJriYiBWE5IYZQ7Xz9yfMg3GUmC7/EF0fCPu1V1
 bsrGFSO4s2FY5ANrA56k
 =S1j1
 -----END PGP SIGNATURE-----

Merge tag 'usb-serial-4.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial into usb-next

Johan writes:

USB-serial updates for v4.3-rc1

Here's a fix for a long-standing issue with the pl2303 divisor
calculations that affects some non-standard baudrates that were enabled
in v3.18.

Adding support for newer Edgeport devices and firmware required changes
to the io_ti driver and also exposed some issues with the driver's
current firmware handling.

Included is also a URL comment-typo fix.

Signed-off-by: Johan Hovold <johan@kernel.org>
2015-08-17 09:09:51 -07:00