1
0
Fork 0
alistair23-linux/drivers/usb
Pawel Laszczak c707e18796 usb: gadget: Fix issue with config_ep_by_speed function
[ Upstream commit 5d363120aa ]

This patch adds new config_ep_by_speed_and_alt function which
extends the config_ep_by_speed about alt parameter.
This additional parameter allows to find proper usb_ss_ep_comp_descriptor.

Problem has appeared during testing f_tcm (BOT/UAS) driver function.

f_tcm function for SS use array of headers for both  BOT/UAS alternate
setting:

static struct usb_descriptor_header *uasp_ss_function_desc[] = {
        (struct usb_descriptor_header *) &bot_intf_desc,
        (struct usb_descriptor_header *) &uasp_ss_bi_desc,
        (struct usb_descriptor_header *) &bot_bi_ep_comp_desc,
        (struct usb_descriptor_header *) &uasp_ss_bo_desc,
        (struct usb_descriptor_header *) &bot_bo_ep_comp_desc,

        (struct usb_descriptor_header *) &uasp_intf_desc,
        (struct usb_descriptor_header *) &uasp_ss_bi_desc,
        (struct usb_descriptor_header *) &uasp_bi_ep_comp_desc,
        (struct usb_descriptor_header *) &uasp_bi_pipe_desc,
        (struct usb_descriptor_header *) &uasp_ss_bo_desc,
        (struct usb_descriptor_header *) &uasp_bo_ep_comp_desc,
        (struct usb_descriptor_header *) &uasp_bo_pipe_desc,
        (struct usb_descriptor_header *) &uasp_ss_status_desc,
        (struct usb_descriptor_header *) &uasp_status_in_ep_comp_desc,
        (struct usb_descriptor_header *) &uasp_status_pipe_desc,
        (struct usb_descriptor_header *) &uasp_ss_cmd_desc,
        (struct usb_descriptor_header *) &uasp_cmd_comp_desc,
        (struct usb_descriptor_header *) &uasp_cmd_pipe_desc,
        NULL,
};

The first 5 descriptors are associated with BOT alternate setting,
and others are associated with UAS.

During handling UAS alternate setting f_tcm driver invokes
config_ep_by_speed and this function sets incorrect companion endpoint
descriptor in usb_ep object.

Instead setting ep->comp_desc to uasp_bi_ep_comp_desc function in this
case set ep->comp_desc to uasp_ss_bi_desc.

This is due to the fact that it searches endpoint based on endpoint
address:

        for_each_ep_desc(speed_desc, d_spd) {
                chosen_desc = (struct usb_endpoint_descriptor *)*d_spd;
                if (chosen_desc->bEndpoitAddress == _ep->address)
                        goto ep_found;
        }

And in result it uses the descriptor from BOT alternate setting
instead UAS.

Finally, it causes that controller driver during enabling endpoints
detect that just enabled endpoint for bot.

Signed-off-by: Jayshri Pawar <jpawar@cadence.com>
Signed-off-by: Pawel Laszczak <pawell@cadence.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-06-24 17:50:32 +02:00
..
atm USB: atm: ueagle-atm: add missing endpoint check 2019-12-17 19:55:44 +01:00
c67x00 USB: add SPDX identifiers to all remaining Makefiles 2017-11-07 15:53:48 +01:00
cdns3 usb: cdns3: gadget: prev_req->trb is NULL for ep0 2020-05-20 08:20:31 +02:00
chipidea usb: chipidea: msm: Ensure proper controller reset using role switch API 2020-05-14 07:58:25 +02:00
class usblp: poison URBs upon disconnect 2020-06-24 17:50:13 +02:00
common usb: common: usb-conn-gpio: Don't log an error on probe deferral 2019-12-17 19:55:39 +01:00
core USB: core: Fix misleading driver bug report 2020-05-27 17:46:34 +02:00
dwc2 usb: dwc2: gadget: move gadget resume after the core is in L0 state 2020-06-24 17:50:32 +02:00
dwc3 usb: dwc3: gadget: Properly handle failed kick_transfer 2020-06-24 17:50:23 +02:00
early USB: early: Handle AMD's spec-compliant identifiers, too 2020-04-29 16:33:13 +02:00
gadget usb: gadget: Fix issue with config_ep_by_speed function 2020-06-24 17:50:32 +02:00
host USB: host: ehci-mxc: Add error handling in ehci_mxc_drv_probe() 2020-06-24 17:50:29 +02:00
image USB: microtek: fix info-leak at probe 2019-10-04 11:02:58 +02:00
isp1760 usb: add a HCD_DMA flag instead of guestimating DMA capabilities 2019-08-21 10:03:35 -07:00
misc USB: sisusbvga: Change port variable from signed to unsigned 2020-04-29 16:33:13 +02:00
mon usb: mon: Fix a deadlock in usbmon between mmap and read 2019-12-17 19:55:49 +01:00
mtu3 usb: mtu3: fix missing include of mtu3_dr.h 2019-10-27 08:58:44 +02:00
musb usb: musb: Fix runtime PM imbalance on error 2020-06-10 20:24:56 +02:00
phy usb: phy: twl6030-usb: Fix a resource leak in an error handling path in 'twl6030_usb_probe()' 2020-06-03 08:21:12 +02:00
renesas_usbhs usb: renesas_usbhs: add suspend event support in gadget mode 2019-12-31 16:43:37 +01:00
roles usb: roles: fix a potential use after free 2019-12-17 19:55:46 +01:00
serial USB: serial: ch341: add basis for quirk detection 2020-06-10 20:24:55 +02:00
storage USB: uas: add quirk for LaCie 2Big Quadra 2020-05-14 07:58:25 +02:00
typec usb: typec: altmode: Fix typec_altmode_get_partner sometimes returning an invalid pointer 2020-04-29 16:33:23 +02:00
usbip usbip: Fix error path of vhci_recv_ret_submit() 2019-12-31 16:46:05 +01:00
Kconfig usb: common: create Kconfig file 2019-09-03 19:00:39 +02:00
Makefile USB: Changes for v5.4 merge window 2019-09-02 19:20:57 +02:00
usb-skeleton.c USB: usb-skeleton: drop redundant in-urb check 2019-10-10 12:41:19 +02:00