lkml.org 
[lkml]   [2017]   [Mar]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Date
    Subject[PATCH 3.2 005/199] usb: gadget: composite: correctly initialize ep->maxpacket
    3.2.87-rc1 review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Felipe Balbi <felipe.balbi@linux.intel.com>

    commit e8f29bb719b47a234f33b0af62974d7a9521a52c upstream.

    usb_endpoint_maxp() returns wMaxPacketSize in its
    raw form. Without taking into consideration that it
    also contains other bits reserved for isochronous
    endpoints.

    This patch fixes one occasion where this is a
    problem by making sure that we initialize
    ep->maxpacket only with lower 10 bits of the value
    returned by usb_endpoint_maxp(). Note that seperate
    patches will be necessary to audit all call sites of
    usb_endpoint_maxp() and make sure that
    usb_endpoint_maxp() only returns lower 10 bits of
    wMaxPacketSize.

    Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
    Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
    ---
    drivers/usb/gadget/composite.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    --- a/drivers/usb/gadget/composite.c
    +++ b/drivers/usb/gadget/composite.c
    @@ -156,7 +156,7 @@ int config_ep_by_speed(struct usb_gadget

    ep_found:
    /* commit results */
    - _ep->maxpacket = usb_endpoint_maxp(chosen_desc);
    + _ep->maxpacket = usb_endpoint_maxp(chosen_desc) & 0x7ff;
    _ep->desc = chosen_desc;
    _ep->comp_desc = NULL;
    _ep->maxburst = 0;
    \
     
     \ /
      Last update: 2017-03-10 14:19    [W:4.769 / U:0.520 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site