Re: [PATCH] USB: gadgetfs: Fix crash caused by inadequate synchronization

2017-09-22 Thread Greg KH
On Thu, Sep 21, 2017 at 01:23:58PM -0400, Alan Stern wrote: > The gadgetfs driver (drivers/usb/gadget/legacy/inode.c) was written > before the UDC and composite frameworks were adopted; it is a legacy > driver. As such, it expects that once bound to a UDC controller, it > will not be unbound until

Re: usb/storage/uas: slab-out-of-bounds in uas_probe

2017-09-22 Thread Greg Kroah-Hartman
On Thu, Sep 21, 2017 at 03:04:05PM -0400, Alan Stern wrote: > On Thu, 21 Sep 2017, Andrey Konovalov wrote: > > > On Thu, Sep 21, 2017 at 6:10 PM, Greg Kroah-Hartman > > wrote: > > > On Thu, Sep 21, 2017 at 05:39:05PM +0200, Andrey Konovalov wrote: > > >> Hi! > > >> > > >> I've got the following r

Re: usb/storage/uas: slab-out-of-bounds in uas_probe

2017-09-22 Thread Greg Kroah-Hartman
On Fri, Sep 22, 2017 at 09:58:15AM +0200, Greg Kroah-Hartman wrote: > On Thu, Sep 21, 2017 at 03:04:05PM -0400, Alan Stern wrote: > > On Thu, 21 Sep 2017, Andrey Konovalov wrote: > > > > > On Thu, Sep 21, 2017 at 6:10 PM, Greg Kroah-Hartman > > > wrote: > > > > On Thu, Sep 21, 2017 at 05:39:05PM

Re: [PATCH 1/2] ARM: dts: exynos: Add dwc3 SUSPHY quirk

2017-09-22 Thread Andrzej Pietrasiewicz
Hi, W dniu 19.09.2017 o 20:10, Robin Murphy pisze: On 19/09/17 18:40, Krzysztof Kozlowski wrote: On Mon, Sep 18, 2017 at 12:02:13PM +0200, Andrzej Pietrasiewicz wrote: Odroid XU4 board does not enumerate SuperSpeed devices. This patch makes exynos5 series chips use USB SUSPHY quirk, which solv

[PATCH 0/9] use setup_timer() helper function.

2017-09-22 Thread Allen Pais
This series uses setup_timer() helper function. The series addresses the files under drivers/usb/*. Allen Pais (9): drivers: usb: hcd: use setup_timer() helper. drivers: usb: phy: omap: use setup_timer() helper. usb: gadget: udc: m66592: use setup_timer() helper. usb: gadget: udc: pxa25x_u

[PATCH 1/9] drivers: usb: hcd: use setup_timer() helper.

2017-09-22 Thread Allen Pais
Use setup_timer function instead of initializing timer with the function and data fields. Signed-off-by: Allen Pais --- drivers/usb/core/hcd.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 75ad671..67aa3d0 10064

[PATCH 2/9] drivers: usb: phy: omap: use setup_timer() helper.

2017-09-22 Thread Allen Pais
Use setup_timer function instead of initializing timer with the function and data fields. Signed-off-by: Allen Pais --- drivers/usb/phy/phy-isp1301-omap.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/usb/phy/phy-isp1301-omap.c b/drivers/usb/phy/phy-isp130

[PATCH 5/9] drivers: usb: atm: cxacru: use setup_timer() helper.

2017-09-22 Thread Allen Pais
Use setup_timer function instead of initializing timer with the function and data fields. Signed-off-by: Allen Pais --- drivers/usb/atm/cxacru.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c index 5160a4a..600a670

[PATCH 4/9] usb: gadget: udc: pxa25x_udc: use setup_timer() helper.

2017-09-22 Thread Allen Pais
Use setup_timer function instead of initializing timer with the function and data fields. Signed-off-by: Allen Pais --- drivers/usb/gadget/udc/pxa25x_udc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/usb/gadget/udc/pxa25x_udc.c b/drivers/usb/gadget/udc/p

[PATCH 6/9] usb: gadget: udc: r8a66597: use setup_timer() helper.

2017-09-22 Thread Allen Pais
Use setup_timer function instead of initializing timer with the function and data fields. Signed-off-by: Allen Pais --- drivers/usb/gadget/udc/r8a66597-udc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/usb/gadget/udc/r8a66597-udc.c b/drivers/usb/gadget/u

[PATCH 8/9] usb: gadget: udc: dummy_hcd: use setup_timer() helper.

2017-09-22 Thread Allen Pais
Use setup_timer function instead of initializing timer with the function and data fields. Signed-off-by: Allen Pais --- drivers/usb/gadget/udc/dummy_hcd.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/usb/gadget/udc/dummy_hcd.c b/drivers/usb/gadget/ud

[PATCH 9/9] usb: gadget: udc: snps_udc_core: use setup_timer() helper.

2017-09-22 Thread Allen Pais
Use setup_timer function instead of initializing timer with the function and data fields. Signed-off-by: Allen Pais --- drivers/usb/gadget/udc/snps_udc_core.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/usb/gadget/udc/snps_udc_core.c b/drivers/usb/g

[PATCH 7/9] drivers: usb: speedtch: use setup_timer() helper.

2017-09-22 Thread Allen Pais
Use setup_timer function instead of initializing timer with the function and data fields. Signed-off-by: Allen Pais --- drivers/usb/atm/speedtch.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/usb/atm/speedtch.c b/drivers/usb/atm/speedtch.c index 3

[PATCH 3/9] usb: gadget: udc: m66592: use setup_timer() helper.

2017-09-22 Thread Allen Pais
Use setup_timer function instead of initializing timer with the function and data fields. Signed-off-by: Allen Pais --- drivers/usb/gadget/udc/m66592-udc.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/usb/gadget/udc/m66592-udc.c b/drivers/usb/gadget/udc/m

Re: [PATCH] USB: gadgetfs: Fix crash caused by inadequate synchronization

2017-09-22 Thread Felipe Balbi
Hi, Greg KH writes: > On Thu, Sep 21, 2017 at 01:23:58PM -0400, Alan Stern wrote: >> The gadgetfs driver (drivers/usb/gadget/legacy/inode.c) was written >> before the UDC and composite frameworks were adopted; it is a legacy >> driver. As such, it expects that once bound to a UDC controller, it

Re: [PATCH] USB: g_mass_storage: Fix deadlock when driver is unbound

2017-09-22 Thread Felipe Balbi
Alan Stern writes: > As a holdover from the old g_file_storage gadget, the g_mass_storage > legacy gadget driver attempts to unregister itself when its main > operating thread terminates (if it hasn't been unregistered already). > This is not strictly necessary; it was never more than an attempt t

Re: [PATCH] USB: gadgetfs: fix copy_to_user while holding spinlock

2017-09-22 Thread Felipe Balbi
Alan Stern writes: > The gadgetfs driver as a long-outstanding FIXME, regarding a call of > copy_to_user() made while holding a spinlock. This patch fixes the > issue by dropping the spinlock and using the dev->udc_usage mechanism > introduced by another recent patch to guard against status chan

Re: [PATCH v2 3/9] clk: at91: pmc: Support backup for programmable clocks

2017-09-22 Thread Nicolas Ferre
On 15/09/2017 at 16:04, Romain Izard wrote: > From: Romain Izard > > When an AT91 programmable clock is declared in the device tree, register > it into the Power Management Controller driver. On entering suspend mode, > the driver saves and restores the Programmable Clock registers to support > t

Re: usb/storage/uas: slab-out-of-bounds in uas_probe

2017-09-22 Thread Andrey Konovalov
On Thu, Sep 21, 2017 at 9:04 PM, Alan Stern wrote: > On Thu, 21 Sep 2017, Andrey Konovalov wrote: > >> On Thu, Sep 21, 2017 at 6:10 PM, Greg Kroah-Hartman >> wrote: >> > On Thu, Sep 21, 2017 at 05:39:05PM +0200, Andrey Konovalov wrote: >> >> Hi! >> >> >> >> I've got the following report while fuz

Re: [PATCH v2 1/9] clk: at91: pmc: Wait for clocks when resuming

2017-09-22 Thread Ludovic Desroches
On Fri, Sep 15, 2017 at 04:04:03PM +0200, Romain Izard wrote: > Wait for the syncronization of all clocks when resuming, not only the > UPLL clock. Do not use regmap_read_poll_timeout, as it will call BUG() > when interrupts are masked, which is the case in here. > > Signed-off-by: Romain Izard A

Re: [PATCH v1 01/10] clk: at91: pmc: Wait for clocks when resuming

2017-09-22 Thread Nicolas Ferre
On 14/09/2017 at 18:15, Romain Izard wrote: > 2017-09-13 14:15 GMT+02:00 Nicolas Ferre : >> On 08/09/2017 at 17:35, Romain Izard wrote: >>> Wait for the syncronization of all clocks when resuming, not only the >>> UPLL clock. Do not use regmap_read_poll_timeout, as it will call BUG() >>> when inter

Re: [PATCH v2 1/9] clk: at91: pmc: Wait for clocks when resuming

2017-09-22 Thread Nicolas Ferre
On 15/09/2017 at 16:04, Romain Izard wrote: > Wait for the syncronization of all clocks when resuming, not only the > UPLL clock. Do not use regmap_read_poll_timeout, as it will call BUG() > when interrupts are masked, which is the case in here. > > Signed-off-by: Romain Izard And here is my: Ac

Re: [PATCH v2 6/9] ehci-atmel: Power down during suspend is normal

2017-09-22 Thread Nicolas Ferre
On 15/09/2017 at 16:04, Romain Izard wrote: > When an Atmel SoC is suspended with the backup mode, the USB bus will be > powered down. As this is expected, do not return an error to the driver > core when ehci_resume detects it. > > Signed-off-by: Romain Izard > --- > drivers/usb/host/ehci-atmel

Re: [PATCH v2 7/9] pwm: atmel-tcb: Support backup mode

2017-09-22 Thread Nicolas Ferre
On 15/09/2017 at 16:04, Romain Izard wrote: > Save and restore registers for the PWM on suspend and resume, which > makes hibernation and backup modes possible. > > Signed-off-by: Romain Izard Seems good to me: Acked-by: Nicolas Ferre > --- > drivers/pwm/pwm-atmel-tcb.c | 63 > ++

usb/media/zr364xx: GPF in zr364xx_vidioc_querycap/strlcpy

2017-09-22 Thread Andrey Konovalov
Hi! I've got the following report while fuzzing the kernel with syzkaller. On commit ebb2c2437d8008d46796902ff390653822af6cc4 (Sep 18). usb 1-1: new full-speed USB device number 2 using dummy_hcd gadgetfs: connected gadgetfs: disconnected gadgetfs: connected usb 1-1: config 225 has an invalid in

Re: [PATCH v2 08/11] staging: typec: tcpm: Set mux to device mode when configured as such

2017-09-22 Thread Hans de Goede
Hi, On 09/11/2017 12:56 AM, Guenter Roeck wrote: On 09/05/2017 09:42 AM, Hans de Goede wrote: Setting the mux to TYPEC_MUX_NONE, TCPC_USB_SWITCH_DISCONNECT when the data-role is device is not correct. Plenty of devices support operating as USB device through a (separate) USB device controller.

Re: usb/storage/uas: slab-out-of-bounds in uas_probe

2017-09-22 Thread Alan Stern
On Fri, 22 Sep 2017, Greg Kroah-Hartman wrote: > On Fri, Sep 22, 2017 at 09:58:15AM +0200, Greg Kroah-Hartman wrote: > > On Thu, Sep 21, 2017 at 03:04:05PM -0400, Alan Stern wrote: > > > On Thu, 21 Sep 2017, Andrey Konovalov wrote: > > > > > > > On Thu, Sep 21, 2017 at 6:10 PM, Greg Kroah-Hartman

Re: ASM1153 detected as ASM1051 and breaking UAS

2017-09-22 Thread Massimo Burcheri
On Tue, 2017-09-19 at 10:00 +0200, Oliver Neukum wrote: > > "In order to use UAS that must be enabled in the firmware as well. On that > > device it is not enabled and the official product id wouldn't help there > > either." > > > > What does that mean? Did I purchase a UAS capable hardware with

Re: [PATCH 9/9 v2] usb: usb251xb: Use GPIO descriptor consumer interface

2017-09-22 Thread Serge Semin
On Thu, Sep 21, 2017 at 05:07:14PM +0200, Greg KH wrote: > On Thu, Sep 21, 2017 at 05:51:29PM +0300, Serge Semin wrote: > > On Thu, Sep 21, 2017 at 10:23:38AM +0200, Greg KH > > wrote: > > > On Sat, Sep 16, 2017 at 01:42:20PM +0300, Serge Semin wrote: > > > > diff --git a/drivers/usb/misc/usb25

[PATCH] USB: uas: fix bug in handling of alternate settings

2017-09-22 Thread Alan Stern
The uas driver has a subtle bug in the way it handles alternate settings. The uas_find_uas_alt_setting() routine returns an altsetting value (the bAlternateSetting number in the descriptor), but uas_use_uas_driver() then treats that value as an index to the intf->altsetting array, which it isn't.

Re: [PATCH 9/9 v2] usb: usb251xb: Use GPIO descriptor consumer interface

2017-09-22 Thread Greg KH
On Fri, Sep 22, 2017 at 06:26:54PM +0300, Serge Semin wrote: > On Thu, Sep 21, 2017 at 05:07:14PM +0200, Greg KH > wrote: > > On Thu, Sep 21, 2017 at 05:51:29PM +0300, Serge Semin wrote: > > > On Thu, Sep 21, 2017 at 10:23:38AM +0200, Greg KH > > > wrote: > > > > On Sat, Sep 16, 2017 at 01:42:2

Re: Fibocom L831-EAU and cdc_mbim

2017-09-22 Thread Andreas Böhler
On 19/09/17 17:38, Bjørn Mork wrote: > Andreas Böhler writes: > >> On 19/09/17 14:25, Bjørn Mork wrote: >>> Bjørn Mork writes: >>> >>> Maybe we should simply ignore stalls completely? They should not happen >>> with any real WDM device anyway. >>> >>> What happens if you e.g. change the if-test

[PATCH][for 4.14] xhci: allow TRACE to work with EVENT ring dequeue

2017-09-22 Thread Adam Wallis
inc_deq() currently bails earlier for EVENT rings than the common return point of the function, due to the fact that EVENT rings do not have link TRBs. The unfortunate side effect of this is that the very useful trace_xhci_inc_deq() function is not called/usable for EVENT ring debug. This patch pr

Re: Fibocom L831-EAU and cdc_mbim

2017-09-22 Thread Bjørn Mork
Andreas Böhler writes: > As promised I made the new module the default and tested it for a few > days. Although the error messages persist, I did not notice any negative > side effects. In fact, it also fixes a problem where mbim-proxy was at > 100% load. > > Two other users also reported success

[PATCH v3 14/14] platform/x86: intel_cht_int33fe: Add mux mappings for the Type-C port

2017-09-22 Thread Hans de Goede
We need to add mappings for the mux subsys to be able to find the muxes for the fusb302 driver to be able to control the PI3USB30532 Type-C mux and the device/host mux integrated in the CHT SoC. Signed-off-by: Hans de Goede Acked-by: Andy Shevchenko --- drivers/platform/x86/Kconfig

[PATCH v3 13/14] staging: typec: fusb302: Hook up mux support using tcpc_gen_mux support

2017-09-22 Thread Hans de Goede
Add mux support to the fusb302 driver, call devm_tcpc_gen_mux_create() to let the generic tcpc_mux_dev code create a tcpc_mux_dev for us. Also document the mux-names used by the generic tcpc_mux_dev code in our devicetree bindings. Cc: Rob Herring Cc: Mark Rutland Cc: devicet...@vger.kernel.org

[PATCH v3 12/14] staging: typec: Add Generic TCPC mux driver using the mux subsys

2017-09-22 Thread Hans de Goede
So far the mux functionality of the tcpm code has not been hooked up in any tcpc drivers. This commit adds a generic TCPC mux driver using the mux subsys, which tcpc drivers can use to provide mux functionality in cases where an external my is used. Signed-off-by: Hans de Goede --- Changes in v3:

[PATCH v3 11/14] staging: typec: tcpm: Set mux to device mode when configured as such

2017-09-22 Thread Hans de Goede
Setting the mux to TYPEC_MUX_NONE, TCPC_USB_SWITCH_DISCONNECT when the data-role is device is not correct. Plenty of devices support operating as USB device through a (separate) USB device controller. So this commit instead splits out TYPEC_MUX_USB into TYPEC_MUX_USB_HOST and TYPEC_MUX_USB_DEVICE

[PATCH v3 10/14] extcon: intel-int3496: Add support for controlling the USB-role mux

2017-09-22 Thread Hans de Goede
Cherry Trail SoCs have a built-in USB-role mux for switching between the host and device controllers, rather then using an external mux controller by a GPIO. There is a driver using the mux-subsys to control this mux, this commit adds support to the intel-int3496 driver to get a mux_controller han

[PATCH v3 09/14] mux: Add Pericom PI3USB30532 Type-C mux driver

2017-09-22 Thread Hans de Goede
Add a driver for the Pericom PI3USB30532 Type-C cross switch / mux chip found on some devices with a Type-C port. Signed-off-by: Hans de Goede --- Changes in v2: -Adjust for new MUX_TYPEC_foo state defines -Add MAINTAINERS entry -Various code-style fixes Changes in v3: -Use new init_as_is mux fl

[PATCH v3 08/14] mux: Add Intel Cherrytrail USB mux driver

2017-09-22 Thread Hans de Goede
Intel Cherrytrail SoCs have an internal USB mux for muxing the otg-port USB data lines between the xHCI host controller and the dwc3 gadget controller. On some Cherrytrail systems this mux is controlled through AML code reacting on a GPIO IRQ connected to the USB OTG id pin (through an _AIE ACPI me

[PATCH v3 07/14] xhci: Add Intel cherrytrail extended cap / otg phy mux handling

2017-09-22 Thread Hans de Goede
The Intel cherrytrail xhci controller has an extended cap mmio-range which contains registers to control the muxing to the xhci (host mode) or the dwc3 (device mode) and vbus-detection for the otg usb-phy. Having a mux driver included in the xhci code (or under drivers/usb/host) is not desirable.

[PATCH v3 05/14] mux: core: Add usb.h header with MUX_USB_* and and MUX_TYPEC_* state constants

2017-09-22 Thread Hans de Goede
Add MUX_USB_* and MUX_TYPEC_* state constant defines, which can be used by USB device/host, resp. Type-C polarity/role/altmode mux drivers and consumers to ensure that they agree on the meaning of the mux_control_select() state argument. Signed-off-by: Hans de Goede --- Changes in v2: -Start numb

[PATCH v3 04/14] mux: core: Add support for getting a mux controller on a non DT platform

2017-09-22 Thread Hans de Goede
On non DT platforms we cannot get the mux_chip by pnode. Other subsystems (regulator, clock, pwm) have the same problem and solve this by allowing platform / board-setup code to add entries to a lookup table and then use this table to look things up. This commit adds support for getting a mux cont

[PATCH v3 03/14] mux: core: Add of_mux_control_get helper function

2017-09-22 Thread Hans de Goede
Currently the mux_control_get implementation only deals with getting mux controllers on DT platforms. This commit renames the current implementation to of_mux_control_get to reflect this and makes mux_control_get a wrapper around of_mux_control_get. This is a preparation patch for adding support f

[PATCH v3 01/14] mux: core: Add mux_control_get_optional() API

2017-09-22 Thread Hans de Goede
From: Stephen Boyd Sometimes drivers only use muxes under certain scenarios. For example, the chipidea usb controller may be connected to a usb switch on some platforms, and connected directly to a usb port on others. The driver won't know one way or the other though, so add a mux_control_get_opt

[PATCH v3 02/14] mux: core: Add explicit hook to leave the mux as-is on init/registration

2017-09-22 Thread Hans de Goede
From: Peter Rosin A board may need a mux controller to stay as-is for a while longer, e.g. if setting the normally preferred idle state destroys booting. The mechanism provided here is not perfect in two ways. 1. As soon as the mux controller is registered, some mux consumer can access it and

[PATCH v3 06/14] xhci: Add option to get next extended capability in list by passing id = 0

2017-09-22 Thread Hans de Goede
From: Mathias Nyman Modify xhci_find_next_ext_cap(base, offset, id) to return the next capability offset if 0 is passed for id. Otherwise it will behave as previously and return the offset of the next capability with matching id capability id 0 is not used by xhci (reserved) This is useful when

[PATCH] r8152: add Linksys USB3GIGV1 id

2017-09-22 Thread Grant Grundler
This Linksys dongle by default comes up in cdc_ether mode. This patch allows r8152 to claim the device: Bus 002 Device 002: ID 13b1:0041 Linksys Signed-off-by: Grant Grundler --- drivers/net/usb/r8152.c | 2 ++ 1 file changed, 2 insertions(+) This was tested on chromeos-3.14, chromeos-3.18,

[PATCH v2][for 4.14] xhci: allow TRACE to work with EVENT ring dequeue

2017-09-22 Thread Adam Wallis
inc_deq() currently bails earlier for EVENT rings than the common return point of the function, due to the fact that EVENT rings do not have link TRBs. The unfortunate side effect of this is that the very useful trace_xhci_inc_deq() function is not called/usable for EVENT ring debug. This patch pr

[PATCH] USB: cdc-wdm: ignore -EPIPE from GetEncapsulatedResponse

2017-09-22 Thread Bjørn Mork
The driver will forward errors to userspace after turning most of them into -EIO. But all status codes are not equal. The -EPIPE (stall) in particular can be seen more as a result of normal USB signaling than an actual error. The state is automatically cleared by the USB core without intervention f

[PATCH 2/2] USB: devio: Don't corrupt user memory

2017-09-22 Thread Dan Carpenter
The user buffer has "uurb->buffer_length" bytes. If the kernel has more information than that, we should truncate it instead of writing past the end of the user's buffer. I added a WARN_ONCE() to help the user debug the issue. Reported-by: Alan Stern Signed-off-by: Dan Carpenter diff --git a/

[PATCH v2 1/2] USB: devio: Prevent integer overflow in proc_do_submiturb()

2017-09-22 Thread Dan Carpenter
There used to be an integer overflow check in proc_do_submiturb() but we removed it. It turns out that it's still required. The uurb->buffer_length variable is a signed integer and it's controlled by the user. It can lead to an integer overflow when we do: num_sgs = DIV_ROUND_UP(uurb->b

Re: [PATCH v2 1/2] USB: devio: Prevent integer overflow in proc_do_submiturb()

2017-09-22 Thread Alan Stern
On Fri, 22 Sep 2017, Dan Carpenter wrote: > There used to be an integer overflow check in proc_do_submiturb() but > we removed it. It turns out that it's still required. The > uurb->buffer_length variable is a signed integer and it's controlled by > the user. It can lead to an integer overflow