lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1509454904-4966-1-git-send-email-rogerq@ti.com>
Date:   Tue, 31 Oct 2017 15:01:44 +0200
From:   Roger Quadros <rogerq@...com>
To:     <balbi@...nel.org>
CC:     <Dylan.Howey@...nantco.com>, <linux-usb@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>, Roger Quadros <rogerq@...com>,
        "# v4 . 13+" <stable@...r.kernel.org>
Subject: [PATCH] usb: dwc3: gadget: Fix .udc_set_speed()

UDC core calls .udc_set_speed() with the speed parameter
containing the maximum speed supported by the gadget function
driver. This might very well be more or less than that
supported by the dwc3 controller driver.

Select the lesser of the 2 speeds so both are operating
within limits.

This fixes PHY Erratic errors and 2 second enumeration delay on
TI's AM437x platforms.

Fixes: 7d8d0639565f ("usb: dwc3: gadget: implement ->udc_set_speed()")
Cc: <stable@...r.kernel.org> # v4.13+
Reported-by: Dylan Howey <Dylan.Howey@...nantco.com>
Signed-off-by: Roger Quadros <rogerq@...com>
---
 drivers/usb/dwc3/gadget.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index f064f15..9f27ec0 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -2008,6 +2008,8 @@ static void dwc3_gadget_set_speed(struct usb_gadget *g,
 	unsigned long		flags;
 	u32			reg;
 
+	speed = min(g->max_speed, speed);
+
 	spin_lock_irqsave(&dwc->lock, flags);
 	reg = dwc3_readl(dwc->regs, DWC3_DCFG);
 	reg &= ~(DWC3_DCFG_SPEED_MASK);
-- 
cheers,
-roger

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ