Граф коммитов

16362 Коммитов

Автор SHA1 Сообщение Дата
Greg Kroah-Hartman 6b98174b95 usb: fixes for v4.8-rc6
Unfortunately we have a bogus dwc3 patch leaked through the cracks and
 got merged into Linus' HEAD. That patch ended up causing off-by-1 error
 in our TRB accounting logic. Thankfully John Youn found out the problem
 and we provided a revert to the bogus dwc3 patch in no time.
 
 Apart from this off-by-1 error, we have two fixes to the Renesas drivers,
 a small fix to our generic phy driver, a NULL pointer dereference fix for
 f_eem and a build warning fix in dwc3.
 -----BEGIN PGP SIGNATURE-----
 
 iQI6BAABCAAkBQJX0q5rHRxmZWxpcGUuYmFsYmlAbGludXguaW50ZWwuY29tAAoJ
 EMy+uJnhGpkGH6wQAMDzaBu5uIieW8b/GmYw6Ujx7omXvPWUHPEE1AQbqjjT92dE
 jR5AoVafirIlEFNesfKFPnNV/egK0tkYk7QxIcjh+4K6VCTwUCsjwyy9nocfVWT3
 34aR9B4dTWCGqaUGE+p8qNgd/Zvsnb4ISW6w14k0iQdFpXrLkSmPpZBK+22a6Brl
 RRRbqV+nMEPpjK6zcpuio39X5njk9yLi7Nru0zkbKr9mS9uTPs4F2VELclxApIjP
 WxSrXoXl2g2FkVEVpRjtzzye5/Ie4GLLXiirLEjM9EM8txIS4lLOW5y9QvFAeWzY
 m8Gmaej64Os53zMfHQgHJTGoxGhA2msKngzeqowAnwzdCHcMo1zELzOc0rWcsFMZ
 85C/WEngMZEHdJXX5mcQf875x1WDfYJgGTM0OFRAEIoi8KFgpY3hUJmMPTyLlzvs
 p+nlWYscGIbca9pP47fs1GQb2w2DrDacBgsKZco33tfSPL+8p90O6ywfzrsZo0oL
 QPxVhrU4v+HXl8k4MSGmoEIrhupwxJWreHkS9YXPnTKJ/YDUQCG5OqIrcAod9Yur
 eBBo7fQ5R3p5QbRsuKmieZGptvWmEsyrx3hG1DEc53Q4145uPzvMaZSYe5zUzHjS
 IvoYwluyWFGSruLsny+WHZp0AhGvVAAQOI15f3P4B5DDC+0qdwVGWGQQK449
 =UcMZ
 -----END PGP SIGNATURE-----

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

Felipe writes:

usb: fixes for v4.8-rc6

Unfortunately we have a bogus dwc3 patch leaked through the cracks and
got merged into Linus' HEAD. That patch ended up causing off-by-1 error
in our TRB accounting logic. Thankfully John Youn found out the problem
and we provided a revert to the bogus dwc3 patch in no time.

Apart from this off-by-1 error, we have two fixes to the Renesas drivers,
a small fix to our generic phy driver, a NULL pointer dereference fix for
f_eem and a build warning fix in dwc3.
2016-09-09 15:11:35 +02:00
Greg Kroah-Hartman 1b49dae1ca Fix the possible kernel panic when the hardware signal is bad for chipidea udc.
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJX0oXaAAoJEEhZKYFQ1nG7298H/RKxcA44iet+zvv8z8EX2yZt
 /H26bzu1/5S6GilXmI92KdEdpNgT1bBwp1ZqrGmMh9Zoi13X1aJJEnQGiyn9kxwK
 VHNb8UZ7OT2M6Sqf29zlrNfK6zxh3ou8UMK7Gv3YHjL1s0nFtkCsED4vdbisIMnj
 UuHzkT5C9l/mnJPhM9G44vXOwJFEZhWdfL5D+KSIi5JlMuBj0z9FZkGiSnchqrzb
 IbQvoPWjt+eUCkktTY8yEIU8RThqzVRJrqjeT3TBt3wYZHfCqvVnmCc81QpxvBub
 ZIJ1vhPd8zjP/FO6zMD//Rt/B4aTTodqWPtU5EaLwSkYASDBBYJunpyzZWZ+B7s=
 =TwAO
 -----END PGP SIGNATURE-----

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

Peter writes:

Fix the possible kernel panic when the hardware signal is bad for chipidea udc.
2016-09-09 13:47:20 +02:00
Clemens Gruber 6f3c4fb6d0 usb: chipidea: udc: fix NULL ptr dereference in isr_setup_status_phase
Problems with the signal integrity of the high speed USB data lines or
noise on reference ground lines can cause the i.MX6 USB controller to
violate USB specs and exhibit unexpected behavior.

It was observed that USBi_UI interrupts were triggered first and when
isr_setup_status_phase was called, ci->status was NULL, which lead to a
NULL pointer dereference kernel panic.

This patch fixes the kernel panic, emits a warning once and returns
-EPIPE to halt the device and let the host get stalled.
It also adds a comment to point people, who are experiencing this issue,
to their USB hardware design.

Cc: <stable@vger.kernel.org> #4.1+
Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2016-09-09 17:19:57 +08:00
Mathias Nyman bcf42aa60c xhci: fix null pointer dereference in stop command timeout function
The stop endpoint command has its own 5 second timeout timer.
If the timeout function is triggered between USB3 and USB2 host
removal it will try to call usb_hc_died(xhci_to_hcd(xhci)->primary_hcd)

the ->primary_hcd will be set to NULL at USB3 hcd removal.

Fix this by first checking if the PCI host is being removed, and
also by using only xhci_to_hcd() as it will always return the primary
hcd.

CC: <stable@vger.kernel.org>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-08 08:39:46 +02:00
Felipe Balbi 696118c016 usb: dwc3: pci: fix build warning on !PM_SLEEP
When building a kernel with CONFIG_PM_SLEEP=n, we
get the following warning:

drivers/usb/dwc3/dwc3-pci.c:253:12: warning: 'dwc3_pci_pm_dummy' defined but not used

In order to fix this, we should only define
dwc3_pci_pm_dummy() when CONFIG_PM_SLEEP is defined.

Fixes: f6c274e11e ("usb: dwc3: pci: runtime_resume child device")
Reported-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-09-07 15:37:36 +03:00
Colin Ian King 3ff488ab60 usb: gadget: prevent potenial null pointer dereference on skb->len
An earlier fix partially fixed the null pointer dereference on skb->len
by moving the assignment of len after the check on skb being non-null,
however it failed to remove the erroneous dereference when assigning len.
Correctly fix this by removing the initialisation of len as was
originally intended.

Fixes: 70237dc8ef ("usb: gadget: function: f_eem: socket buffer may be NULL")
Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-09-06 10:44:03 +03:00
Yoshihiro Shimoda 519d8bd4b5 usb: renesas_usbhs: fix clearing the {BRDY,BEMP}STS condition
The previous driver is possible to stop the transfer wrongly.
For example:
 1) An interrupt happens, but not BRDY interruption.
 2) Read INTSTS0. And than state->intsts0 is not set to BRDY.
 3) BRDY is set to 1 here.
 4) Read BRDYSTS.
 5) Clear the BRDYSTS. And then. the BRDY is cleared wrongly.

Remarks:
 - The INTSTS0.BRDY is read only.
  - If any bits of BRDYSTS are set to 1, the BRDY is set to 1.
  - If BRDYSTS is 0, the BRDY is set to 0.

So, this patch adds condition to avoid such situation. (And about
NRDYSTS, this is not used for now. But, avoiding any side effects,
this patch doesn't touch it.)

Fixes: d5c6a1e024 ("usb: renesas_usbhs: fixup interrupt status clear method")
Cc: <stable@vger.kernel.org> # v3.8+
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-09-05 13:39:23 +03:00
Fabio Estevam 7c113f7df7 usb: phy: phy-generic: Check clk_prepare_enable() error
clk_prepare_enable() may fail, so we should better check its return
value and propagate it in the case of failure.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-09-05 13:39:23 +03:00
Yoshihiro Shimoda b2f1eaaee5 usb: gadget: udc: renesas-usb3: clear VBOUT bit in DRD_CON
This driver should clear the bit. Otherwise, the VBUS will output
wrongly if the usb port on a board has VBUS output capability.

Fixes: 746bfe63bb ("usb: gadget: renesas_usb3: add support for
		      Renesas USB3.0 peripheral controller")
Cc: <stable@vger.kernel.org> # v4.5+
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-09-05 13:39:23 +03:00
John Youn 9d7aba7786 Revert "usb: dwc3: gadget: always decrement by 1"
This reverts commit 6f8245b4e3 ("usb: dwc3: gadget: always decrement
by 1").

We can't always decrement this value.

We should decrement only if the calculation of free slots results in a
LINK TRB being among one of the free slots (dequeue < enqueue).

Otherwise, if the LINK TRB is not among the free slots then it should
not be decremented.

Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-09-05 13:39:23 +03:00
Tony Lindgren 2c5575401e usb: musb: Fix locking errors for host only mode
If we have USB gadgets disabled and USB_MUSB_HOST set, we get
errors "possible irq lock inverssion dependency detected"
errors during boot.

Let's fix the issue by adding start_musb flag and start
the controller after we're out of the spinlock protected
section.

Reported-by: Ladislav Michl <ladis@linux-mips.org>
Tested-by: Ladislav Michl <ladis@linux-mips.org>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-30 14:11:38 +02:00
Greg Kroah-Hartman 83b4a3d79e Fix one bug that host can't work after insmod gadget module
at dual-role mode, the root cause of this issue is the usbcmd.rs
 is cleared by chipidea udc code.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQEcBAABAgAGBQJXtmlkAAoJEEhZKYFQ1nG7NNYIAJkZkiDvmdJWj9Bd0m742ftB
 nroxMUAD02CJNRj1vH2h/9ahTjsTsXDyO8sFbWxgmBxpg7JKwuOFNXZQaFUHqZXh
 aLjNW8199iX5bRiAncEgeJvZGDRoOo7mHrCtNGBYCvDXWqISI5CiyHzT7svzEHus
 7AleXuWp/SnexOT/LS9xSZ//ooCtMCMBR+2Ns+QYQrHVtI6CwZ6umC8jiK9Xec7L
 FSyPfpZk9sQtcMN27Cgk8D7YFx/Z13SHgfF139LZNNwUQYsjkfjD7Ru6okkmxFS2
 bvy7LJlYaGVKoezjB6VktNL/fZ8DoggC2gFTe6kbmHhev/u1YDM+JBU21Jo4MzA=
 =VOuU
 -----END PGP SIGNATURE-----

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

Peter writes:

Fix one bug that host can't work after insmod gadget module
at dual-role mode, the root cause of this issue is the usbcmd.rs
is cleared by chipidea udc code.
2016-08-30 14:09:17 +02:00
Greg Kroah-Hartman d1228f4ff3 USB-serial fixes for v4.8-rc4
Here are a couple of fixes for non-atomic allocations in write paths,
 and some new option device ids.
 
 Signed-off-by: Johan Hovold <johan@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJXvxNgAAoJEEEN5E/e4bSVibEP/1HuoOsGKaOR9RI3y/dRzcFe
 ZVYtKQZ2M+zYBRlkbTGKpGO8urzfNL3T+TfA51i2HUnsa9s4AEFuyoC8eW/amj3D
 mKm2rn0BwPH+E86Pvg0Jgf/tyveCGB3u2rbkZWHhbbJDA/eI2nX1w9DlldSHpZfx
 PgFKPemBeUSc+AKIuw2eAbw4y9Br2hnvb2ZDzXE7CHpiu/Jnk6UuXCO6aygr+IAj
 KK0dcW1D+QBoefHgNNMydk1OMvs5BAl/GdnUn5UqlMfe95b617eaOhkQlM0h+JVk
 yO2zLF8tz64xE5gYzT0PWeHBSl5Ugf0yVQdIypYToldIellIz+2z8TxfQ38U0Fu5
 fyB4c2KAy3+CESDgNZZMYXOPY1sfkjArTrvrbp4lwbgZTlg+CTtcn63OXl0DDhIW
 x5w0KpguralZvjmhjKrmi46TljEX05UV/PqtConXuFujylyXTq36RLF+1OeH+ZyW
 +MGYHHHvqjK4/uqesXmu52UQPq08VaBktxUwqaKhh/0Pg1ta0XcdCH+6dBEeWy5i
 idHFFQBqV9QE08DhLPa24kS+DOpmEUiTi/AOxpdlpDtsW4XkbVv7IF/t3W+sx6G5
 U+XfoujHcYBrIbfiN/kcE1W896Y+MeJ8VhCRxCt8vwmgYXTjwpkYaq2eYaA+zp/Z
 PddZx/fqr8W5ADICIyyj
 =bKLC
 -----END PGP SIGNATURE-----

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

Johan writes:

USB-serial fixes for v4.8-rc4

Here are a couple of fixes for non-atomic allocations in write paths,
and some new option device ids.

Signed-off-by: Johan Hovold <johan@kernel.org>
2016-08-25 17:00:01 -04:00
Greg Kroah-Hartman 368907ddb2 usb: fixes for v4.8-rc3
Few fixes on dwc3 again, the most important being a
 fix for pm_runtime to make it work with current
 intel platforms.
 
 Other than that, there's a signedness bug fix in fsl
 udc and some other minor fixes.
 -----BEGIN PGP SIGNATURE-----
 
 iQI6BAABCAAkBQJXvrw3HRxmZWxpcGUuYmFsYmlAbGludXguaW50ZWwuY29tAAoJ
 EIaOsuA1yqREWCMP/0zlF8sqCLgTOJcR8wBbzCCY6CLxrWrBxUB5+Ld6gs101f/0
 d1YEqgRtGxauaJVdTfwiSoVTb+WGzG97ExHXBSQjcxniG/3u39Yq+KkKao6+Y4iR
 bqoT7vqPkLqNhVxzIL2Mx0uWBiCibl2NrAfXreNhSxHkabrf6JsWMfQ9Kc0N47/j
 aFRJ4U+NG/q53NbSfpfSxYG0p0LB4BHEpR0BVIKtWxMgFEsdwOMM6ZyqHpw3pede
 km7wqp/7HAUu2rhiZFQtLuPa7yjqlGEZ8vO1ERzIACDy+CiedRoJW+hHE0rJn4TL
 xjCLGEEeH7pP/lqAmsw6oxjg9cdhTakfMcM0374203U31hTIYC6PK1gRMivvE3rD
 zZ8RLU3NCuAh6HBQaHl/k+i3t9U76K/DJuFbSKnO1wwYMlDS2u6WBUWTXFDanYij
 BTIJSrqAEp+Ne3MCMQ0u79daTO5iTAhf08xbMwLJwY9c8k43bFmo2kYoGjo8aAyi
 0U03NYMfuOTqcTpYNlRXyRhFGdCM0wxvYwzGaUs+oxPzzpsrQiotd0Lm8+UWSB/Y
 b4EfsZew0CBNnN3BPgyPDSrntPFiyL6OV2bRkLnxgUlwVEoEIBqTRu0Uv6bsrLkG
 qO4ibILgDbGUIuC8EyyR3ObQcTNQxxLTbdHyrNIq8dcgLypu3tW9jHHCe6vO
 =Tm2m
 -----END PGP SIGNATURE-----

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

Felipe writes:

usb: fixes for v4.8-rc3

Few fixes on dwc3 again, the most important being a
fix for pm_runtime to make it work with current
intel platforms.

Other than that, there's a signedness bug fix in fsl
udc and some other minor fixes.
2016-08-25 08:54:13 -04:00
Felipe Balbi 6f8245b4e3 usb: dwc3: gadget: always decrement by 1
We need to decrement in both cases (enq > deq and
enq < deq)

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-08-25 12:30:27 +03:00
Felipe Balbi 696fe69d7e usb: dwc3: debug: fix ep name on trace output
There was a typo when generating endpoint name which
would be very confusing when debugging. Fix it.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-08-25 10:36:25 +03:00
Felipe Balbi 23fd537c95 usb: gadget: udc: core: don't starve DMA resources
Always unmap all SG entries as required by DMA API

Fixes: a698908d3b ("usb: gadget: add generic map/unmap request utilities")
Cc: <stable@vger.kernel.org> # v3.4+
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-08-25 10:36:24 +03:00
Aleksandr Makarov 40d9c32525 USB: serial: option: add WeTelecom 0x6802 and 0x6803 products
These product IDs are listed in Windows driver.
0x6803 corresponds to WeTelecom WM-D300.
0x6802 name is unknown.

Signed-off-by: Aleksandr Makarov <aleksandr.o.makarov@gmail.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2016-08-24 14:13:40 +02:00
Alan Stern 53e5f36fbd USB: avoid left shift by -1
UBSAN complains about a left shift by -1 in proc_do_submiturb().  This
can occur when an URB is submitted for a bulk or control endpoint on
a high-speed device, since the code doesn't bother to check the
endpoint type; normally only interrupt or isochronous endpoints have
a nonzero bInterval value.

Aside from the fact that the operation is illegal, it shouldn't matter
because the result isn't used.  Still, in theory it could cause a
hardware exception or other problem, so we should work around it.
This patch avoids doing the left shift unless the shift amount is >= 0.

The same piece of code has another problem.  When checking the device
speed (the exponential encoding for interrupt endpoints is used only
by high-speed or faster devices), we need to look for speed >=
USB_SPEED_SUPER as well as speed == USB_SPEED HIGH.  The patch adds
this check.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Vittorio Zecca <zeccav@gmail.com>
Tested-by: Vittorio Zecca <zeccav@gmail.com>
Suggested-by: Bjørn Mork <bjorn@mork.no>
CC: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-23 16:35:20 -04:00
Alan Stern 6c73358c83 USB: fix typo in wMaxPacketSize validation
The maximum value allowed for wMaxPacketSize of a high-speed interrupt
endpoint is 1024 bytes, not 1023.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Fixes: aed9d65ac3 ("USB: validate wMaxPacketValue entries in endpoint descriptors")
CC: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-23 06:54:32 -04:00
Baolin Wang 511a36d2f3 usb: gadget: Add the gserial port checking in gs_start_tx()
When usb gadget is set gadget serial function, it will be crash in below
situation.

It will clean the 'port->port_usb' pointer in gserial_disconnect() function
when usb link is inactive, but it will release lock for disabling the endpoints
in this function. Druing the lock release period, it maybe complete one request
to issue gs_write_complete()--->gs_start_tx() function, but the 'port->port_usb'
pointer had been set NULL, thus it will be crash in gs_start_tx() function.

This patch adds the 'port->port_usb' pointer checking in gs_start_tx() function
to avoid this situation.

Signed-off-by: Baolin Wang <baolin.wang@linaro.org>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-08-22 10:45:13 +03:00
Nicolas Saenz Julienne d6011f6fc2 usb: dwc3: gadget: don't rely on jiffies while holding spinlock
__dwc3_gadget_wakeup() is called while holding a spinlock, then depends on
jiffies in order to timeout while polling the USB core for a link state
update. In the case the wakeup failed, the timeout will never happen and
will also cause the cpu to stall until rcu_preempt kicks in.

This switches to a "decrement variable and wait" timeout scheme.

Signed-off-by: Nicolas Saenz Julienne <nicolassaenzj@gmail.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-08-22 10:45:13 +03:00
Dan Carpenter f4693b08cc usb: gadget: fsl_qe_udc: signedness bug in qe_get_frame()
We can't assign -EINVAL to a u16.

Fixes: 3948f0e0c9 ('usb: add Freescale QE/CPM USB peripheral controller driver')
Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-08-22 10:45:12 +03:00
Peter Chen 80d1642d76 usb: gadget: function: f_rndis: socket buffer may be NULL
In eth_start_xmit, the socket buffer may be NULL. So, add NULL pointer
check at .wrap API.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-08-22 10:45:12 +03:00
Peter Chen 70237dc8ef usb: gadget: function: f_eem: socket buffer may be NULL
In eth_start_xmit, the socket buffer may be NULL. So, add NULL pointer
check at .wrap API.

Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-08-22 10:45:12 +03:00
Wei Yongjun 3295235fd7 usb: renesas_usbhs: gadget: fix return value check in usbhs_mod_gadget_probe()
In case of error, the function usb_get_phy() returns ERR_PTR() and never
returns NULL. The NULL test in the return value check should be replaced
with IS_ERR().

Fixes: b5a2875605 ("usb: renesas_usbhs: Allow an OTG PHY driver to
	provide VBUS")
Cc: <stable@vger.kernel.org> # v4.3+
Acked-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-08-22 10:45:11 +03:00
Dinh Nguyen 83f8da562f usb: dwc2: Add reset control to dwc2
Allow for platforms that have a reset controller driver in place to bring
the USB IP out of reset.

Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
Acked-by: John Youn <johnyoun@synopsys.com>
Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-08-22 10:45:11 +03:00
Felipe Balbi b74c2d875b usb: dwc3: core: allow device to runtime_suspend several times
After going through runtime_suspend/runtime_resume
cycle once we would be left with an unbalanced
pm_runtime_get() call. Fix that by making sure that
we try to suspend right after resuming so things are
balanced and device can runtime_suspend again.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-08-22 10:45:11 +03:00
Felipe Balbi f6c274e11e usb: dwc3: pci: runtime_resume child device
During runtime_resume of dwc3-pci.c, we need to
runtime suspend our child device (which is dwc3
proper) otherwise nothing will happen.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-08-22 10:45:10 +03:00
Aleksandr Makarov 6695593e4a USB: serial: option: add WeTelecom WM-D200
Add support for WeTelecom WM-D200.

T:  Bus=03 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#=  4 Spd=12  MxCh= 0
D:  Ver= 1.10 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=22de ProdID=6801 Rev=00.00
S:  Manufacturer=WeTelecom Incorporated
S:  Product=WeTelecom Mobile Products
C:  #Ifs= 4 Cfg#= 1 Atr=80 MxPwr=500mA
I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
I:  If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
I:  If#= 3 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage

Signed-off-by: Aleksandr Makarov <aleksandr.o.makarov@gmail.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2016-08-20 15:32:14 +02:00
Li Jun c4e9417498 usb: chipidea: udc: don't touch DP when controller is in host mode
When the controller is configured to be dual role and it's in host mode,
if bind udc and gadgt driver, those gadget operations will do gadget
disconnect and finally pull down DP line, which will break host function.

Cc: <stable@vger.kernel.org> # 4.1+
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
2016-08-19 09:27:07 +08:00
Mathias Nyman f1f6d9a8b5 xhci: don't dereference a xhci member after removing xhci
Remove the hcd after checking for the xhci last quirks, not before.

This caused a hang on a Alpine Ridge xhci based maching which remove
the whole xhci controller when unplugging the last usb device

CC: <stable@vger.kernel.org>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-16 09:42:47 +02:00
Jim Lin 88716a9376 usb: xhci: Fix panic if disconnect
After a device is disconnected, xhci_stop_device() will be invoked
in xhci_bus_suspend().
Also the "disconnect" IRQ will have ISR to invoke
xhci_free_virt_device() in this sequence.
xhci_irq -> xhci_handle_event -> handle_cmd_completion ->
xhci_handle_cmd_disable_slot -> xhci_free_virt_device

If xhci->devs[slot_id] has been assigned to NULL in
xhci_free_virt_device(), then virt_dev->eps[i].ring in
xhci_stop_device() may point to an invlid address to cause kernel
panic.

virt_dev = xhci->devs[slot_id];
:
if (virt_dev->eps[i].ring && virt_dev->eps[i].ring->dequeue)

[] Unable to handle kernel paging request at virtual address 00001a68
[] pgd=ffffffc001430000
[] [00001a68] *pgd=000000013c807003, *pud=000000013c807003,
*pmd=000000013c808003, *pte=0000000000000000
[] Internal error: Oops: 96000006 [#1] PREEMPT SMP
[] CPU: 0 PID: 39 Comm: kworker/0:1 Tainted: G     U
[] Workqueue: pm pm_runtime_work
[] task: ffffffc0bc0e0bc0 ti: ffffffc0bc0ec000 task.ti:
ffffffc0bc0ec000
[] PC is at xhci_stop_device.constprop.11+0xb4/0x1a4

This issue is found when running with realtek ethernet device
(0bda:8153).

Signed-off-by: Jim Lin <jilin@nvidia.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-16 09:42:47 +02:00
Alban Browaeys 0d2daaded8 xhci: really enqueue zero length TRBs.
Enqueue the first TRB even if full_len is zero.
Without this "adb install <apk>" freezes the system.

Signed-off-by: Alban Browaeys <alban.browaeys@gmail.com>
Fixes: 86065c2719 ("xhci: don't rely on precalculated value of needed trbs in the enqueue loop")
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-16 09:42:47 +02:00
Mathias Nyman 33be126510 xhci: always handle "Command Ring Stopped" events
Fix "Command completion event does not match command" errors by always
handling the command ring stopped events.

The command ring stopped event is generated as a result of aborting
or stopping the command ring with a register write. It is not caused
by a command in the command queue, and thus won't have a matching command
in the comman list.

Solve it by handling the command ring stopped event before checking for a
matching command.

In most command time out cases we abort the command ring, and get
a command ring stopped event. The events command pointer will point at
the current command ring dequeue, which in most cases matches the timed
out command in the command list, and no error messages are seen.

If we instead get a command aborted event before the command ring stopped
event, the abort event will increse the command ring dequeue pointer, and
the following command ring stopped events command pointer will point at the
next, not yet queued command. This case triggered the error message

Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
CC: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-16 09:42:47 +02:00
Gavin Li add125054b cdc-acm: fix wrong pipe type on rx interrupt xfers
This fixes the "BOGUS urb xfer" warning logged by usb_submit_urb().

Signed-off-by: Gavin Li <git@thegavinli.com>
Acked-by: Oliver Neukum <oneukum@suse.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-15 16:30:56 +02:00
Alexey Khoroshilov 3b7c7e52ef USB: serial: mos7840: fix non-atomic allocation in write path
There is an allocation with GFP_KERNEL flag in mos7840_write(),
while it may be called from interrupt context.

Follow-up for commit 1912528376 ("USB: kobil_sct: fix non-atomic
allocation in write path")

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

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2016-08-15 10:43:57 +02:00
Alexey Khoroshilov 5a5a1d6142 USB: serial: mos7720: fix non-atomic allocation in write path
There is an allocation with GFP_KERNEL flag in mos7720_write(),
while it may be called from interrupt context.

Follow-up for commit 1912528376 ("USB: kobil_sct: fix non-atomic
allocation in write path")

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

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
2016-08-15 10:37:04 +02:00
Greg Kroah-Hartman fa25425593 USB-serial fixes for v4.8-rc2
Here is a fix of a memory leak in a driver-registration error path, and
 some new device ids.
 
 Signed-off-by: Johan Hovold <johan@kernel.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJXrYB3AAoJEEEN5E/e4bSVz5sQAKjgRwxltR6uu4shLwSlumPA
 F/LWuPxZjKsDfn+QuYNTAw5bJF4smCB9AlCXesXGHSlU8q4wCMdHp2cU9adbmGys
 K6Ah1gzPY+PMkjtW4qiI3kR6AFXE+SgEUKGSskRpkiJ6Vq5IdO+qmk/TNEL96h2w
 B2a8CrPFbd2BW9J0Np3/W7BRMx9g1OUiQzif6vBZXAlGXt+pGlW8sAYZfzzzGddq
 m8UXbnXQkvi7Pr5Gwplcfs7PX3Qd3RLP4St4SpbeYE6uIJ2EgAaHV8uRwMa45Lmi
 AtROmXSj5SkgpqKHPNBxSe/kBqf6HTIGLLSHFKmGHfBQ009S+iPpg2XlQw8MCpLz
 EjX/oji00RgzbtQ10ztyNSxHqRKEdEVZmsWuJvHj01ajLvZgGWpBye2A5c/SUQRF
 yVtsex2YkFCuRDDuhE9iqx5+XOHKEIVHdRIP8EasFTENN8Dt7NLuMqw6YsD4Cf9G
 tdEa2ZuzipwXjqdXUfON0SKNFnjP9KjOOS8+ECnnuj5RlBeELFXIVamXn5vbQDl/
 EI+jAcC2K9Hwa8cVI8FXT/NhBCVv92OMvHVvwnSNiEZFHA30UGhuXZyJfz5SY/Bp
 xP3P2dTbGd9j6X2eQitewIJFdoEkRE0XzT87v1t7Bw01kRB1rIvM5pspy5OcbT62
 YmuVbzihdFQ7Xz++vSSD
 =k37B
 -----END PGP SIGNATURE-----

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

Johan writes:

USB-serial fixes for v4.8-rc2

Here is a fix of a memory leak in a driver-registration error path, and
some new device ids.

Signed-off-by: Johan Hovold <johan@kernel.org>
2016-08-12 16:13:27 +02:00
Lu Baolu 5395875118 usb: misc: usbtest: add fix for driver hang
In sg_timeout(), req->status is set to "-ETIMEDOUT" before calling
into usb_sg_cancel(). usb_sg_cancel() will do nothing and return
directly if req->status has been set to a non-zero value. This will
cause driver hang whenever transfer time out is triggered.

This patch fixes this issue. It could be backported to stable kernel
with version later than v3.15.

Cc: stable@vger.kernel.org # 3.15+
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Suggested-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-08-11 18:31:51 +02:00
Greg Kroah-Hartman 224f6e4036 usb: fixes for v4.8-rc1
First set of fixes for v4.8-rc cycle. Again, dwc3 is
 the most active driver with over 60% of this pull
 request touching it.
 
 The most important fixes are related to scatterlist
 usage with dwc3. Before this pull request, we were
 increment request->actual multiple times and this
 would result in request->actual being larger than
 request->length.
 
 Also, if a we received a short packet midway through
 processing a scatterlist, we were not clearning HWO
 bit as we should.
 
 Other than the large dwc3 scatterlist fixes, we have
 a new Device ID for Intel's Kabylake silicon.
 
 Other drivers, such as fsl_qe_udc and renesas udc,
 also got a few minor fixes. Details are in shortlog.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJXrGw7AAoJEIaOsuA1yqREVv8QAKs+UEW+M2hnX1jolG4525YY
 0fEYHVuH8K+PSzhG0aPr3vWG3GHBn37in4l0Ey5x5dyBxkFN2LQfnPkBWMYQeFAS
 fBwh1o+V+Xec7DHUDqgexb10kOKVI7U2H3Ob9VV9BMYKU1D5SgRduG569UDPzWIJ
 bXyHYOiTEwdubu+eXNAZA05nFSoZinHQ/m/4alaIfoOGJo6sHs7mLuVaAdp4g+OA
 vD6UgOTFSuSB+rDbYLhxSc9kVwRFQKAEe5u/YuI6Puxpsnsu1D5S5t/KPty1DTUV
 UZS63O3L3VcdGe54hew7iPg/UKGcUCaOw/HUJlro+d/jxrz48AqgAlQr3ZGxhdWJ
 LDDkWJJhNJXdBs7TmrrZfC+qhLRhvAXVasf/TFaXAsejHU5KeyiDCp0UU/LnqYlD
 YIAVnxL6er2Sn3jI6KJQ4Ek8uufpAZZ3gFWZ60Ka6AXXYVdu5PTnaca+3J0eyVjZ
 F4kWWyR3wFSJ1zmWvTJsnuww77cLoUu7sPg+w4dvIoG/x1yGg+JBuBJzq1VyF307
 XDHtM+134Y4XVbvz5wIySLOmXnLPCb1F6Gp67GjuoBOMjL086JvFlbut2/bJs7Nj
 6RVHRJUECaTRUQz5dUEYYwoFnjQXgWv7vEn4QD/507jm4krcxhuxaDgtK47yKjXS
 DGjMIGO0b3yK8rvqqoWM
 =7VYA
 -----END PGP SIGNATURE-----

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

Felipe writes:

usb: fixes for v4.8-rc1

First set of fixes for v4.8-rc cycle. Again, dwc3 is
the most active driver with over 60% of this pull
request touching it.

The most important fixes are related to scatterlist
usage with dwc3. Before this pull request, we were
increment request->actual multiple times and this
would result in request->actual being larger than
request->length.

Also, if a we received a short packet midway through
processing a scatterlist, we were not clearning HWO
bit as we should.

Other than the large dwc3 scatterlist fixes, we have
a new Device ID for Intel's Kabylake silicon.

Other drivers, such as fsl_qe_udc and renesas udc,
also got a few minor fixes. Details are in shortlog.
2016-08-11 18:30:35 +02:00
Felipe Balbi a0ad85ae86 usb: dwc3: gadget: stop processing on HWO set
stop consuming TRBs when we reach one with HWO bit
already set. This will prevent us from prematurely
retiring a TRB.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-08-11 15:09:48 +03:00
Janusz Dziedzic 79d17482a4 usb: dwc3: don't set last bit for ISOC endpoints
According to Synopsys Databook 2.60a, section 8.3.4,
it's stated that:

	The LST bit should be set to 0 (isochronous
	transfers normally continue until the
	endpoint is removed entirely, at which time
	an End Transfer command is used to stop the
	transfer).

This patch makes sure that detail is observed and
fixes a regression with Android Audio playback
caused by recent changes to DWC3 gadget.

Signed-off-by: Janusz Dziedzic <januszx.dziedzic@linux.intel.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-08-11 15:09:48 +03:00
Xerox Lin 207707d8fd usb: gadget: rndis: free response queue during REMOTE_NDIS_RESET_MSG
When rndis data transfer is in progress, some Windows7 Host PC is not
sending the GET_ENCAPSULATED_RESPONSE command for receiving the response
for the previous SEND_ENCAPSULATED_COMMAND processed.

The rndis function driver appends each response for the
SEND_ENCAPSULATED_COMMAND in a queue. As the above process got corrupted,
the Host sends a REMOTE_NDIS_RESET_MSG command to do a soft-reset.
As the rndis response queue is not freed, the previous response is sent
as a part of this REMOTE_NDIS_RESET_MSG's reset response and the Host
block any more Rndis transfers.

Hence free the rndis response queue as a part of this soft-reset so that
the correct response for REMOTE_NDIS_RESET_MSG is sent properly during the
response command.

Signed-off-by: Rajkumar Raghupathy <raghup@codeaurora.org>
Signed-off-by: Xerox Lin <xerox_lin@htc.com>
[AmitP: Cherry-picked this patch and folded other relevant
        fixes from Android common kernel android-4.4]
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-08-11 15:09:48 +03:00
Peter Chen 17a1dc5e22 usb: udc: core: fix error handling
The udc device needs to be deleted if error occurs

Fixes: 855ed04a37 ("usb: gadget: udc-core: independent registration of
	gadgets and gadget drivers")
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-08-11 15:09:47 +03:00
Dan Carpenter 7442e6db5b usb: gadget: fsl_qe_udc: off by one in setup_received_handle()
The udc->eps[] array has USB_MAX_ENDPOINTS elements so > should be >=.

Fixes: 3948f0e0c9 ('usb: add Freescale QE/CPM USB peripheral controller driver')
Acked-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-08-11 15:09:47 +03:00
Mathieu Laurendeau 327b21da88 usb/gadget: fix gadgetfs aio support.
Fix io submissions failing with ENODEV.

Signed-off-by: Mathieu Laurendeau <mat.lau@laposte.net>
Fixes: 7fe3976e0f ("gadget: switch ep_io_operations to ->read_iter/->write_iter")
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-08-11 15:09:47 +03:00
Christophe JAILLET 3887db5c2b usb: gadget: composite: Fix return value in case of error
In 'composite_os_desc_req_prepare', if one of the memory allocations fail,
0 will be returned, which means success.
We should return -ENOMEM instead.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-08-11 15:09:46 +03:00
Christophe JAILLET bd610c5aa9 usb: gadget: uvc: Fix return value in case of error
If this memory allocation fail, we will return 0, which means success.
Return -ENOMEM instead.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-08-11 15:09:46 +03:00
Binyamin Sharet 63196e9896 usb: gadget: fix check in sync read from ep in gadgetfs
When reading synchronously from a non-zero endpoint, gadgetfs will
return -EFAULT even if the read succeeds, due to a bad check of the
copy_to_iter() return value.

This fix compares the return value of copy_to_iter to the amount of
bytes that was passed, and only fails if they are not the same.

Signed-off-by: Binyamin Sharet <s.binyamin@gmail.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
2016-08-11 15:09:46 +03:00