Commit graph

9891 commits

Author SHA1 Message Date
Linus Torvalds ad8395e149 USB fixes for 3.9-rc2
Here are a number of tiny USB fixes and new USB device ids for your 3.9
 tree.
 
 The "largest" one here is a revert of a usb-storage patch that turned
 out to be incorrect, breaking existing users, which is never a good
 thing.  Everything else is pretty simple and small
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.19 (GNU/Linux)
 
 iEYEABECAAYFAlFA3rgACgkQMUfUDdst+ylSmQCfdQGXwi/1JX0099FKsnt4dcXY
 SbMAn1GWSwYPo1Uk5joKJpNh412PMnXZ
 =kNF7
 -----END PGP SIGNATURE-----

Merge tag 'usb-3.9-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull USB fixes from Greg Kroah-Hartman:
 "Here are a number of tiny USB fixes and new USB device ids for your
  3.9 tree.

  The "largest" one here is a revert of a usb-storage patch that turned
  out to be incorrect, breaking existing users, which is never a good
  thing.  Everything else is pretty simple and small"

* tag 'usb-3.9-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (43 commits)
  USB: quatech2: only write to the tty if the port is open.
  qcserial: bind to DM/DIAG port on Gobi 1K devices
  USB: cdc-wdm: fix buffer overflow
  usb: serial: Add Rigblaster Advantage to device table
  qcaux: add Franklin U600
  usb: musb: core: fix possible build error with randconfig
  usb: cp210x new Vendor/Device IDs
  usb: gadget: pxa25x: fix disconnect reporting
  usb: dwc3: ep0: fix sparc64 build
  usb: c67x00 RetryCnt value in c67x00 TD should be 3
  usb: Correction to c67x00 TD data length mask
  usb: Makefile: fix drivers/usb/phy/ Makefile entry
  USB: added support for Cinterion's products AH6 and PLS8
  usb: gadget: fix omap_udc build errors
  USB: storage: fix Huawei mode switching regression
  USB: storage: in-kernel modeswitching is deprecated
  tools: usb: ffs-test: Fix build failure
  USB: option: add Huawei E5331
  usb: musb: omap2430: fix sparse warning
  usb: musb: omap2430: fix omap_musb_mailbox glue check again
  ...
2013-03-13 15:03:48 -07:00
Bill Pemberton 27b351c554 USB: quatech2: only write to the tty if the port is open.
The commit 2e124b4a39 removed the checks
that prevented qt2_process_read_urb() from trying to put chars into
ttys that weren't actually opened.  This resulted in 'tty is NULL'
warnings from flush_to_ldisc() when the device was used.

The devices use just one read urb for all ports.  As a result
qt2_process_read_urb() may be called with the current port set to a
port number that has not been opened.  Add a check if the port is open
before calling tty_flip_buffer_push().

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-13 12:32:47 -07:00
Dan Williams 3f8bc5e4da qcserial: bind to DM/DIAG port on Gobi 1K devices
Turns out we just need altsetting 1 and then we can talk to it.

Signed-off-by: Dan Williams <dcbw@redhat.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-13 08:50:42 -07:00
Oliver Neukum c0f5ecee4e USB: cdc-wdm: fix buffer overflow
The buffer for responses must not overflow.
If this would happen, set a flag, drop the data and return
an error after user space has read all remaining data.

Signed-off-by: Oliver Neukum <oliver@neukum.org>
CC: stable@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-12 16:33:05 -07:00
Steve Conklin a57e82a187 usb: serial: Add Rigblaster Advantage to device table
The Rigblaster Advantage is an amateur radio interface sold by West Mountain
Radio. It contains a cp210x serial interface but the device ID is not in
the driver.

Signed-off-by: Steve Conklin <sconklin@canonical.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-12 08:54:41 -07:00
Dan Williams 2d90e63603 qcaux: add Franklin U600
4 ports; AT/PPP is standard CDC-ACM.  The other three (added by this
patch) are QCDM/DIAG, possibly GPS, and unknown.

Signed-off-by: Dan Williams <dcbw@redhat.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-11 11:09:17 -07:00
Felipe Balbi fd5014ad5c usb: musb: core: fix possible build error with randconfig
when making commit e574d57 (usb: musb: fix
compile warning) I forgot to git add this
part of the patch which ended up introducing
a possible build error.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-11 11:09:17 -07:00
Matwey V. Kornilov be3101c233 usb: cp210x new Vendor/Device IDs
This patch adds support for the Lake Shore Cryotronics devices to
the CP210x driver.

These lines are ported from cp210x driver distributed by Lake Shore web site:
   http://www.lakeshore.com/Documents/Lake%20Shore%20cp210x-3.0.0.tar.gz
and licensed under the terms of GPLv2.

Moreover, I've tested this changes with Lake Shore 335 in my labs.

Signed-off-by: Matwey V. Kornilov <matwey@sai.msu.ru>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-11 08:37:35 -07:00
Greg Kroah-Hartman 4fa42e897d usb: fixes for v3.9-rc3
Most fixes are on 'musb' driver. There's a sparse warning
 fix which marks omap2430_glue as static, a build warning
 fix which was found with randconfig, a fix for omap_musb_mailbox
 check and removal of 'select' from musb's Kconfig to prevent
 Kconfig warnings.
 
 Other than that, pxa25x got a fix which was introduced by the
 latest conversion to udc_start/udc_stop patchset, kernel-doc
 warnings for composite layer  and dwc3 got a build fix on
 sparc64.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJRPbnGAAoJEIaOsuA1yqREp/EP/1eT/s06O41ZsB+lVSdB08Ge
 fBW48qBdVETN7RIsPIi/gFiZ/uUj4/yA9Jt1H/sEG1GIX0UalB1SbosWHbzSyih3
 rC9vZk9al1ChOHVDGmxJai+F+ertRy69Ez4nrV2J0U/54dXn+cyI9kYR+KbYJF5V
 mb7ISJnTLN6jDBqvWOb8H7QAg+KGcJaWXjLV+x96g+i1shaWOmJWto15/ZEO88Qn
 Ui/ZJTzRcoYsaljcHUN3N87Ybk6HyR/vU+b4TD//G1hh9dFAOwzCNoUxkpHoJbic
 F9Hv40eQ9oSVGth3FaTDSGPyGM2sgvFuS8BP2+vRvfdnJvmDHx1kmdLiuT5jtbMD
 +7TStucbiCNZneKLw0di/Oz+wWESt1y6nOVRwo6cgBMcU+9ZJV06tOBZu1A6+fT1
 ptLxug8wUpx9iLkYZk8qj74PYiNW0RW0ye8R6c+sMP2fdXIwQPVXqu+zUa42OLXM
 tHUNmcpOtFlLMwaLuMTLH68vuJ3RwrlBwpbYG0RQfncJrHl6E8xH/KLR/80xxAX8
 w5RDliUX5LGKxR/bLACv4H2mluEkq65ipgH7rySu9IRYJp3z71NNjEE1kp2NBSDG
 v/VpBVrX9KkFIncvR55+eaedl0oUQgyI9k4m0mZesc0s7Snjx85ILmX0agbY53tR
 u4+RmnvH6dauAIgEyHbF
 =8Fnj
 -----END PGP SIGNATURE-----

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

Felipe writes:

  usb: fixes for v3.9-rc3

  Most fixes are on 'musb' driver. There's a sparse warning
  fix which marks omap2430_glue as static, a build warning
  fix which was found with randconfig, a fix for omap_musb_mailbox
  check and removal of 'select' from musb's Kconfig to prevent
  Kconfig warnings.

  Other than that, pxa25x got a fix which was introduced by the
  latest conversion to udc_start/udc_stop patchset, kernel-doc
  warnings for composite layer  and dwc3 got a build fix on
  sparc64.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-11 08:20:26 -07:00
Felipe Balbi 66e4afc77f usb: gadget: pxa25x: fix disconnect reporting
when commit 6166c24 (usb: gadget: pxa25x_udc:
convert to udc_start/udc_stop) converted
this driver to udc_start/udc_stop, it failed
to consider the fact that stop_activity()
is called from disconnect interrupt.

Fix the problem so that gadget drivers know
about proper disconnect sequences.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-11 12:40:31 +02:00
Linus Torvalds 72932611b4 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace
Pull namespace bugfixes from Eric Biederman:
 "This is three simple fixes against 3.9-rc1.  I have tested each of
  these fixes and verified they work correctly.

  The userns oops in key_change_session_keyring and the BUG_ON triggered
  by proc_ns_follow_link were found by Dave Jones.

  I am including the enhancement for mount to only trigger requests of
  filesystem modules here instead of delaying this for the 3.10 merge
  window because it is both trivial and the kind of change that tends to
  bit-rot if left untouched for two months."

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace:
  proc: Use nd_jump_link in proc_ns_follow_link
  fs: Limit sys_mount to only request filesystem modules (Part 2).
  fs: Limit sys_mount to only request filesystem modules.
  userns: Stop oopsing in key_change_session_keyring
2013-03-09 16:51:13 -08:00
Andrew Morton c390b0363d usb: dwc3: ep0: fix sparc64 build
drivers/usb/dwc3/ep0.c: In function `__dwc3_ep0_do_control_data':
drivers/usb/dwc3/ep0.c:905: error: `typeof' applied to a bit-field

Looks like a gcc-3.4.5/sparc64 bug.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-08 09:42:50 +02:00
Dave Tubbs b44983bb9b usb: c67x00 RetryCnt value in c67x00 TD should be 3
RetryCnt value in c67x00 TD should be 3 (both bits set to 1). Reference
Cypress Semiconductor BIOS User's Manual 1.2, page 3-14

Signed-off-by: Dave Tubbs <dave.tubbs@portalislc.com>
Acked-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-07 12:31:37 +08:00
Dave Tubbs 5df3c35183 usb: Correction to c67x00 TD data length mask
TD data length is 10 bits, correct TD_PORTLENMASK_DL. Reference
Cypress Semiconductor BIOS User's Manual 1.2, page 3-10

Signed-off-by: Dave Tubbs <dave.tubbs@portalislc.com>
Acked-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-07 12:31:37 +08:00
Felipe Balbi 1c2088812f usb: Makefile: fix drivers/usb/phy/ Makefile entry
drivers/usb/phy/ should be compiled everytime
we have CONFIG_USB_OTG_UTILS enabled.

phy/ should've been part of the build process based
on CONFIG_USB_OTG_UTILS, don't know where I had my head
when I allowed CONFIG_USB_COMMON there.

In fact commit c6156328de
tried to fix a previous issue but it made things even
worse.

The real solution is to compile phy/ based on
CONFIG_USB_OTG_UTILS which gets selected by all PHY
drivers.

I only triggered the error recently after accepting a
patch which moved a bunch of code from otg/otg.c to
phy/phy.c and running 100 randconfig cycles.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-07 12:29:09 +08:00
Christian Schmiedl 1941138e1c USB: added support for Cinterion's products AH6 and PLS8
add support for Cinterion's products AH6 and PLS8 by adding Product IDs
and USB_DEVICE tuples.

Signed-off-by: Christian Schmiedl <christian.schmiedl@gemalto.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-07 12:29:09 +08:00
Arnd Bergmann 518868c8fe usb: gadget: fix omap_udc build errors
1bf0cf6040 "usb: gadget: omap_udc: convert to udc_start/udc_stop"
made some trivial changes but was missing a ';' character.

8c4cc00552 "ARM: OMAP1: DMA: Moving OMAP1 DMA channel definitions
to mach-omap1" added a definition for OMAP_DMA_USB_W2FC_TX0 to
the driver while making the header file it was defined in
unavailable for drivers, but this driver actually needs
OMAP_DMA_USB_W2FC_RX0 as well.

Both changes appear trivial, so let's add the missing semicolon
and the macro definition.

Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-07 12:29:08 +08:00
Bjørn Mork ab4b71644a USB: storage: fix Huawei mode switching regression
This reverts commit 200e0d99 ("USB: storage: optimize to match the
Huawei USB storage devices and support new switch command" and the
followup bugfix commit cd060956 ("USB: storage: properly handle
the endian issues of idProduct").

The commit effectively added a large number of Huawei devices to
the deprecated usb-storage mode switching logic.  Many of these
devices have been in use and supported by the userspace
usb_modeswitch utility for years.  Forcing the switching inside
the kernel causes a number of regressions as a result of ignoring
existing onfigurations, and also completely takes away the ability
to configure mode switching per device/system/user.

Known regressions caused by this:
 - Some of the devices support multiple modes, using different
  switching commands.  There are existing configurations taking
  advantage of this.

 - There is a real use case for disabling mode switching and
  instead mounting the exposed storage device. This becomes
  impossible with switching logic inside the usb-storage driver.

 - At least on device fail as a result of the usb-storage switching
  command, becoming completely unswitchable. This is possibly a
  firmware bug, but still a regression because the device work as
  expected using usb_modeswitch defaults.

In-kernel mode switching was deprecated years ago with the
development of the more user friendly userspace alternatives. The
existing list of devices in usb-storage was only kept to prevent
breaking already working systems.  The long term plan is to remove
the list, not to add to it. Ref:
http://permalink.gmane.org/gmane.linux.usb.general/28543

Cc: <fangxiaozhi@huawei.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-07 12:23:17 +08:00
Bjørn Mork fbb8c745ec USB: storage: in-kernel modeswitching is deprecated
Acked-by: Matthew Dharm <mdharm-usb@one-eyed-alien.net>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-07 12:23:17 +08:00
Bjørn Mork daec90e738 USB: option: add Huawei E5331
Another device using CDC ACM with vendor specific protocol to mark
serial functions.

Cc: stable <stable@vger.kernel.org>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-07 12:23:16 +08:00
Aaro Koskinen 4b58ed11c6 usb: musb: omap2430: fix sparse warning
Fix the following sparse warning:

drivers/usb/musb/omap2430.c:54:33: warning: symbol '_glue' was not \
	declared. Should it be static?

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-05 13:28:32 +02:00
Aaro Koskinen f8c4b0e73b usb: musb: omap2430: fix omap_musb_mailbox glue check again
Commit 80ab72e1 (usb: musb: omap2430: fix the readiness check
in omap_musb_mailbox) made the check incorrect, as we will lose the
glue/link status during the normal built-in probe order (twl4030_usb is
probed after musb omap2430, but before musb core is ready).

As a result, if you boot with USB cable on and load g_ether, the
connection does not work as the code thinks the cable is off and the
phy gets powered down immediately. This is a major regression in 3.9-rc1.

So the proper check should be: exit if _glue is NULL, but if it's
initialized we memorize the status, and then check if the musb core
is ready.

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-05 13:26:59 +02:00
Felipe Balbi e574d57081 usb: musb: fix compile warning
When running 100 randconfig iterations, I found
the following warning:

drivers/usb/musb/musb_core.c: In function ‘musb_init_controller’:
drivers/usb/musb/musb_core.c:1981:1: warning: label ‘fail5’ defined \
	but not used [-Wunused-label]

this patch fixes it by removing the unnecessary
ifdef CONFIG_SYSFS.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-05 13:25:36 +02:00
Felipe Balbi 341a71c790 usb: musb: remove all 'select' from Kconfig
those are quite unnecessary, the only thing
we need to be careful about is USB_OTG_UTILS
which get properly selected by PHY drivers.

For now, MUSB will select only USB_OTG_UTILS
until we add stubs for the cases when PHY
layer isn't enabled.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-05 13:22:40 +02:00
Nishanth Menon 43febb27dc usb: gadget: composite: fix kernel-doc warnings
A few trivial fixes for composite driver:

Warning(include/linux/usb/composite.h:165): No description found for parameter
	'fs_descriptors'
Warning(include/linux/usb/composite.h:165): Excess struct/union/enum/typedef
	member 'descriptors' description in 'usb_function'
Warning(include/linux/usb/composite.h:321): No description found for parameter
	'gadget_driver'
Warning(drivers/usb/gadget/composite.c:1777): Excess function parameter 'bind'
	description in 'usb_composite_probe'

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Kosina <trivial@kernel.org>
Cc: linux-usb@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-05 13:15:00 +02:00
Alan Stern feca7746d5 USB: EHCI: don't check DMA values in QH overlays
This patch (as1661) fixes a rather obscure bug in ehci-hcd.  In a
couple of places, the driver compares the DMA address stored in a QH's
overlay region with the address of a particular qTD, in order to see
whether that qTD is the one currently being processed by the hardware.
(If it is then the status in the QH's overlay region is more
up-to-date than the status in the qTD, and if it isn't then the
overlay's value needs to be adjusted when the QH is added back to the
active schedule.)

However, DMA address in the overlay region isn't always valid.  It
sometimes will contain a stale value, which may happen by coincidence
to be equal to a qTD's DMA address.  Instead of checking the DMA
address, we should check whether the overlay region is active and
valid.  The patch tests the ACTIVE bit in the overlay, and clears this
bit when the overlay becomes invalid (which happens when the
currently-executing URB is unlinked).

This is the second part of a fix for the regression reported at:

	https://bugs.launchpad.net/bugs/1088733

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-by: Joseph Salisbury <joseph.salisbury@canonical.com>
Reported-and-tested-by: Stephen Thirlwall <sdt@dr.com>
CC: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-05 08:45:33 +08:00
Alan Stern 6402c796d3 USB: EHCI: work around silicon bug in Intel's EHCI controllers
This patch (as1660) works around a hardware problem present in some
(if not all) Intel EHCI controllers.  After a QH has been unlinked
from the async schedule and the corresponding IAA interrupt has
occurred, the controller is not supposed access the QH and its qTDs.
There certainly shouldn't be any more DMA writes to those structures.
Nevertheless, Intel's controllers have been observed to perform a
final writeback to the QH's overlay region and to the most recent qTD.
For more information and a test program to determine whether this
problem is present in a particular controller, see

	http://marc.info/?l=linux-usb&m=135492071812265&w=2
	http://marc.info/?l=linux-usb&m=136182570800963&w=2

This patch works around the problem by always waiting for two IAA
cycles when unlinking an async QH.  The extra IAA delay gives the
controller time to perform its final writeback.

Surprisingly enough, the effects of this silicon bug have gone
undetected until quite recently.  More through luck than anything
else, it hasn't caused any apparent problems.  However, it does
interact badly with the path that follows this one, so it needs to be
addressed.

This is the first part of a fix for the regression reported at:

	https://bugs.launchpad.net/bugs/1088733

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Tested-by: Stephen Thirlwall <sdt@dr.com>
CC: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-05 08:45:33 +08:00
Rafael J. Wysocki 53540098b2 ACPI / glue: Add .match() callback to struct acpi_bus_type
USB uses the .find_bridge() callback from struct acpi_bus_type
incorrectly, because as a result of the way it is used by USB every
device in the system that doesn't have a bus type or parent is
passed to usb_acpi_find_device() for inspection.

What USB actually needs, though, is to call usb_acpi_find_device()
for USB ports that don't have a bus type defined, but have
usb_port_device_type as their device type, as well as for USB
devices.

To fix that replace the struct bus_type pointer in struct
acpi_bus_type used for matching devices to specific subsystems
with a .match() callback to be used for this purpose and update
the users of struct acpi_bus_type, including USB, accordingly.
Define the .match() callback routine for USB, usb_acpi_bus_match(),
in such a way that it will cover both USB devices and USB ports
and remove the now redundant .find_bridge() callback pointer from
usb_acpi_bus.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Yinghai Lu <yinghai@kernel.org>
Acked-by: Jeff Garzik <jgarzik@pobox.com>
2013-03-04 14:23:40 +01:00
Dan Carpenter 29240e2392 usb: gadget: u_uac1: NULL dereference on error path
We should return here with an error code instead of continuing.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-04 13:16:45 +02:00
Dan Carpenter fddedd8334 usb: gadget: f_uac1: silence an info leak warning
Smatch complains that "len" could be larger than the sizeof(value)
so we could be copying garbage here.  I have changed this to match
how things are done in composite_setup().

The call tree looks like:
  composite_setup()
  --> f_audio_setup()
      --> audio_get_intf_req()

composite_setup() expects the return value to be set to
sizeof(value).

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-04 13:13:58 +02:00
Sachin Kamat 57ae575b8a usb: phy: omap-control-usb: Convert to devm_ioremap_resource()
Use the newly introduced devm_ioremap_resource() instead of
devm_request_and_ioremap() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages; so all explicit
error messages can be removed from the failure code paths.

Reviewed-by: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-04 13:08:53 +02:00
Sachin Kamat 862421da0d usb: phy: omap-usb3: Convert to devm_ioremap_resource()
Use the newly introduced devm_ioremap_resource() instead of
devm_request_and_ioremap() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages; so all explicit
error messages can be removed from the failure code paths.

Reviewed-by: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-04 13:08:48 +02:00
Sachin Kamat a400704103 usb: phy: samsung: Convert to devm_ioremap_resource()
Use the newly introduced devm_ioremap_resource() instead of
devm_request_and_ioremap() which provides more consistent error handling.

devm_ioremap_resource() provides its own error messages; so all explicit
error messages can be removed from the failure code paths.

Reviewed-by: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-04 13:08:39 +02:00
Marc Kleine-Budde 1dd03d8a51 usb: otg: use try_module_get in all usb_get_phy functions and add missing module_put
In patch "5d3c28b usb: otg: add device tree support to otg library"
devm_usb_get_phy_by_phandle() was added. It uses try_module_get() to lock the
phy driver in memory. The corresponding module_put() is missing in that patch.

This patch adds try_module_get() to usb_get_phy() and usb_get_phy_dev().
Further the missing module_put() is added to usb_put_phy().

Tested-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Reviewed-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-04 09:33:30 +02:00
Peter Ujfalusi a10840c9ac usb: musb: correct Kconfig in order to avoid non compilable selection
Currently it is possible to have:

USB_MUSB_OMAP2PLUS=m
TWL4030_USB=y

which would result compile time error due to missing symbols.

With this change USB_MUSB_OMAP2PLUS and TWL4030_USB will be in sync.

Reported-by: Vincent Stehle <v-stehle@ti.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-04 09:33:30 +02:00
Felipe Balbi 4ea34de761 usb: gadget: s3c2410: fix build breakage
add missing semicolon to fix compile breakage.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-04 09:33:29 +02:00
Felipe Balbi bc530a7272 usb: gadget: imx_udc: fix gadget->dev registration
Whenever ->udc_start() gets called, gadget driver
has already being bound to the udc controller, which
means that gadget->dev had to be already initialized
and added to driver model.

This patch fixes imx_udc mistake.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-04 09:33:28 +02:00
Felipe Balbi 9992a9979f usb: gadget: pxa25x: fix gadget->dev registration
Whenever ->udc_start() gets called, gadget driver
has already being bound to the udc controller, which
means that gadget->dev had to be already initialized
and added to driver model.

This patch fixes pxa25x mistake.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-04 09:33:28 +02:00
Felipe Balbi 7597a49b1e usb: gadget: s3c2410: fix gadget->dev registration
Whenever ->udc_start() gets called, gadget driver
has already being bound to the udc controller, which
means that gadget->dev had to be already initialized
and added to driver model.

This patch fixes s3c2410 mistake.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-04 09:33:27 +02:00
Kishon Vijay Abraham I 56aa45adcc usb: gadget: make usb functions to load before gadget driver
The current ordering in makefile makes gadget
drivers be loaded before usb functions which
causes usb_get_function_instance() to fail when
gadget modules are statically linked to the
kernel binary.

Changed the ordering here so that USB functions
are loaded before gadget drivers.

Note that this is only a temporary solution and
a more robust fix is needed in the long run.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-04 09:33:26 +02:00
Felipe Balbi fe2a4297b4 usb: gadget: pxa27x: fix gadget->dev registration
Whenever ->udc_start() gets called, gadget driver
has already being bound to the udc controller, which
means that gadget->dev had to be already initialized
and added to driver model.

This patch fixes pxa27x mistake.

Tested-by: Robert Jarzmik <robert.jarzmik@free.fr>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-04 09:33:26 +02:00
Felipe Balbi 2b7dc3b1a6 usb: chipidea: register debugging sysfs on our device
Don't register anything non-generic under
the gadget's device as we don't really *own*
it.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-04 09:33:25 +02:00
Felipe Balbi e5b29b25f8 usb: dwc3: gadget: remove unnecessary code
the params variables on dwc3_gadget_conndone_interrupt()
is only memset() to zero but never used in
that function, so we can safely drop the variable
and memset() call.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-04 09:33:25 +02:00
Felipe Balbi d82f3e3cd8 usb: dwc3: glue layers shouldn't know about the core IP
remove inclusion of "core.h" from all glue
layers as they don't need to know details
about the core IP.

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-04 09:33:24 +02:00
Felipe Balbi 2c2dc89cc5 usb: dwc3: omap: fix a typo on of_device_id
s/matach/match

No functional changes

Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-04 09:33:23 +02:00
Felipe Balbi d9b4330ade usb: dwc3: core: don't forget to free coherent memory
commit 3921426 (usb: dwc3: core: move
event buffer allocation out of
dwc3_core_init()) introduced a memory leak
of the coherent memory we use as event
buffers on dwc3 driver.

If the driver is compiled as a dynamically
loadable module and use constantly loads
and unloads the driver, we will continue
to leak the coherent memory allocated during
->probe() because dwc3_free_event_buffers()
is never called during ->remove().

Cc: <stable@vger.kernel.org> # v3.7 v3.8
Signed-off-by: Felipe Balbi <balbi@ti.com>
2013-03-04 09:33:22 +02:00
Eric W. Biederman 7f78e03513 fs: Limit sys_mount to only request filesystem modules.
Modify the request_module to prefix the file system type with "fs-"
and add aliases to all of the filesystems that can be built as modules
to match.

A common practice is to build all of the kernel code and leave code
that is not commonly needed as modules, with the result that many
users are exposed to any bug anywhere in the kernel.

Looking for filesystems with a fs- prefix limits the pool of possible
modules that can be loaded by mount to just filesystems trivially
making things safer with no real cost.

Using aliases means user space can control the policy of which
filesystem modules are auto-loaded by editing /etc/modprobe.d/*.conf
with blacklist and alias directives.  Allowing simple, safe,
well understood work-arounds to known problematic software.

This also addresses a rare but unfortunate problem where the filesystem
name is not the same as it's module name and module auto-loading
would not work.  While writing this patch I saw a handful of such
cases.  The most significant being autofs that lives in the module
autofs4.

This is relevant to user namespaces because we can reach the request
module in get_fs_type() without having any special permissions, and
people get uncomfortable when a user specified string (in this case
the filesystem type) goes all of the way to request_module.

After having looked at this issue I don't think there is any
particular reason to perform any filtering or permission checks beyond
making it clear in the module request that we want a filesystem
module.  The common pattern in the kernel is to call request_module()
without regards to the users permissions.  In general all a filesystem
module does once loaded is call register_filesystem() and go to sleep.
Which means there is not much attack surface exposed by loading a
filesytem module unless the filesystem is mounted.  In a user
namespace filesystems are not mounted unless .fs_flags = FS_USERNS_MOUNT,
which most filesystems do not set today.

Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
Acked-by: Kees Cook <keescook@chromium.org>
Reported-by: Kees Cook <keescook@google.com>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
2013-03-03 19:36:31 -08:00
Linus Torvalds bc2e4a90d9 USB patch revert for 3.9-rc1
Here is one remaining USB patch for 3.9-rc1, it reverts a 3.8 patch that has
 caused a lot of regressions for some VIA EHCI controllers.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.19 (GNU/Linux)
 
 iEYEABECAAYFAlExO/QACgkQMUfUDdst+yny+wCeO71iPtYEPUCl3uiE3TfzYBfW
 kNwAoNJT7mDkFpjJV2TWOYbQCb48pY9r
 =jJ6t
 -----END PGP SIGNATURE-----

Merge tag 'usb-3.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb

Pull USB patch revert from Greg Kroah-Hartman:
 "Here is one remaining USB patch for 3.9-rc1, it reverts a 3.8 patch
  that has caused a lot of regressions for some VIA EHCI controllers."

* tag 'usb-3.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
  USB: EHCI: revert "remove ASS/PSS polling timeout"
2013-03-03 10:24:57 -08:00
Linus Torvalds d895cb1af1 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs pile (part one) from Al Viro:
 "Assorted stuff - cleaning namei.c up a bit, fixing ->d_name/->d_parent
  locking violations, etc.

  The most visible changes here are death of FS_REVAL_DOT (replaced with
  "has ->d_weak_revalidate()") and a new helper getting from struct file
  to inode.  Some bits of preparation to xattr method interface changes.

  Misc patches by various people sent this cycle *and* ocfs2 fixes from
  several cycles ago that should've been upstream right then.

  PS: the next vfs pile will be xattr stuff."

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (46 commits)
  saner proc_get_inode() calling conventions
  proc: avoid extra pde_put() in proc_fill_super()
  fs: change return values from -EACCES to -EPERM
  fs/exec.c: make bprm_mm_init() static
  ocfs2/dlm: use GFP_ATOMIC inside a spin_lock
  ocfs2: fix possible use-after-free with AIO
  ocfs2: Fix oops in ocfs2_fast_symlink_readpage() code path
  get_empty_filp()/alloc_file() leave both ->f_pos and ->f_version zero
  target: writev() on single-element vector is pointless
  export kernel_write(), convert open-coded instances
  fs: encode_fh: return FILEID_INVALID if invalid fid_type
  kill f_vfsmnt
  vfs: kill FS_REVAL_DOT by adding a d_weak_revalidate dentry op
  nfsd: handle vfs_getattr errors in acl protocol
  switch vfs_getattr() to struct path
  default SET_PERSONALITY() in linux/elf.h
  ceph: prepopulate inodes only when request is aborted
  d_hash_and_lookup(): export, switch open-coded instances
  9p: switch v9fs_set_create_acl() to inode+fid, do it before d_instantiate()
  9p: split dropping the acls from v9fs_set_create_acl()
  ...
2013-02-26 20:16:07 -08:00
Alan Stern 221f8dfca8 USB: EHCI: revert "remove ASS/PSS polling timeout"
This patch (as1649) reverts commit
55bcdce8a8 (USB: EHCI: remove ASS/PSS
polling timeout).  That commit was written under the assumption that
some controllers may take a very long time to turn off their async and
periodic schedules.  It now appears that in fact the schedules do get
turned off reasonably quickly, but some controllers occasionally leave
the schedules' status bits turned on and consequently ehci-hcd can't
tell that the schedules are off.

VIA controllers in particular have this problem.  ehci-hcd tells the
hardware to turn off the async schedule, the schedule does get turned
off, but the status bit remains on.  Since the EHCI spec requires that
the schedules not be re-enabled until the previous disable has taken
effect, with an unlimited timeout the async schedule never gets turned
back on.  The resulting symptom is that the system is unable to
communicate with USB devices.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Reported-and-tested-by: Ronald <ronald645@gmail.com>
Reported-and-tested-by: Paul Hartman <paul.hartman@gmail.com>
Reported-and-tested-by: Dieter Nützel <dieter@nuetzel-hh.de>
Reported-and-tested-by: Jean Delvare <khali@linux-fr.org>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-26 13:22:38 -08:00