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-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 1 Nov 2017 17:11:18 +0200
From:   Roger Quadros <rogerq@...com>
To:     Alan Stern <stern@...land.harvard.edu>
CC:     <balbi@...nel.org>, <Dylan.Howey@...nantco.com>,
        <linux-usb@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        "# v4 . 13+" <stable@...r.kernel.org>
Subject: Re: [PATCH v2][RESEND] usb: gadget: core: Fix ->udc_set_speed() speed
 handling

Hi Alan,

On 01/11/17 16:24, Alan Stern wrote:
> On Tue, 31 Oct 2017, Roger Quadros wrote:
> 
>> Currently 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 than that supported by the
>> UDC controller driver.
>>
>> Select the lesser of the 2 speeds so both UDC and gadget function
>> driver are operating within limits.
>>
>> This fixes PHY Erratic errors and 2 second enumeration delay on
>> TI's AM437x platforms.
>>
>> Fixes: 6099eca796ae ("usb: gadget: core: introduce ->udc_set_speed() method")
>> Cc: <stable@...r.kernel.org> # v4.13+
>> Reported-by: Dylan Howey <Dylan.Howey@...nantco.com>
>> Signed-off-by: Roger Quadros <rogerq@...com>
>> ---
>> v2:
>> - Move speed limiting code to UDC core.
>>
>>  drivers/usb/gadget/udc/core.c | 8 ++++++--
>>  1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c
>> index d41d07a..def1b05 100644
>> --- a/drivers/usb/gadget/udc/core.c
>> +++ b/drivers/usb/gadget/udc/core.c
>> @@ -1080,8 +1080,12 @@ static inline void usb_gadget_udc_stop(struct usb_udc *udc)
>>  static inline void usb_gadget_udc_set_speed(struct usb_udc *udc,
>>  					    enum usb_device_speed speed)
>>  {
>> -	if (udc->gadget->ops->udc_set_speed)
>> -		udc->gadget->ops->udc_set_speed(udc->gadget, speed);
>> +	if (udc->gadget->ops->udc_set_speed) {
>> +		enum usb_device_speed s;
>> +
>> +		s = min(speed, udc->gadget->max_speed);
>> +		udc->gadget->ops->udc_set_speed(udc->gadget, s);
>> +	}
>>  }
>>  
>>  /**
> 
> Roger, would you like to send in a follow-up patch that removes the now 
> unnecessary code from dummy_udc_set_speed() in dummy_hcd.c?
> 

Sure. I have a question though.

In dummy_udc_set_speed() we should just set gadget.speed to whatever is passed in speed.
This will be the maximum supported speed by the gadget function driver.

However, is it possible that the gadget will be connected at a lower speed than that?

I see gadget.speed being updated in dummy_hub_control() GetPortStatus: case, but not
in case of USB_SPEED_HIGH and USB_SPEED_LOW.

-- 
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