Message ID | 1448431069-9287-1-git-send-email-tedchen@realtek.com |
---|---|
State | Accepted |
Commit | 1b108880e6433e398681785f51b2a2dca983cd1b |
Delegated to: | Marek Vasut |
Headers | show |
On Wednesday, November 25, 2015 at 06:57:48 AM, Ted Chen wrote: > Add a condition of set_address and set_configuration to check > if the request is standardized. > > Signed-off-by: Ted Chen <tedchen@realtek.com> > --- > drivers/usb/host/xhci.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c > index ca598aa..cb8a04b 100644 > --- a/drivers/usb/host/xhci.c > +++ b/drivers/usb/host/xhci.c > @@ -941,10 +941,12 @@ static int _xhci_submit_control_msg(struct usb_device > *udev, unsigned long pipe, if (usb_pipedevice(pipe) == ctrl->rootdev) > return xhci_submit_root(udev, pipe, buffer, setup); > Hi! What do you say we reorder the check a little: if ((setup->requesttype & USB_TYPE_MASK) == USB_TYPE_STANDARD) { if (setup->request == USB_REQ_SET_ADDRESS) return xhci_address_device(udev, root_portnr); if (setup->request == USB_REQ_SET_CONFIGURATION) ... } Also, I suspect this sort of fix needs to be applied to at least dwc3 ep0.c, r8a66597-hcd.c and musb_hcd.c as well. Paging Hans so he can share his visdom too :) > - if (setup->request == USB_REQ_SET_ADDRESS) > + if (setup->request == USB_REQ_SET_ADDRESS && > + (setup->requesttype & USB_TYPE_MASK) == USB_TYPE_STANDARD) > return xhci_address_device(udev, root_portnr); > > - if (setup->request == USB_REQ_SET_CONFIGURATION) { > + if (setup->request == USB_REQ_SET_CONFIGURATION && > + (setup->requesttype & USB_TYPE_MASK) == USB_TYPE_STANDARD) { > ret = xhci_set_configuration(udev); > if (ret) { > puts("Failed to configure xHCI endpoint\n"); Best regards, Marek Vasut
Hi Marek, > -----Original Message----- > From: Marek Vasut [mailto:marex@denx.de] > Sent: Thursday, November 26, 2015 9:25 AM > To: Ted > Cc: swarren@nvidia.com; u-boot@lists.denx.de; > linux.amoon@gmail.com; Hans de Goede > Subject: Re: [PATCH] usb: xhci: Fix vendor command error if > the request type is USB_REQ_SET_ADDRESS or USB_REQ_SET_CONFIGURATION. > > On Wednesday, November 25, 2015 at 06:57:48 AM, Ted Chen wrote: > > Add a condition of set_address and set_configuration to > check if the > > request is standardized. > > > > Signed-off-by: Ted Chen <tedchen@realtek.com> > > --- > > drivers/usb/host/xhci.c | 6 ++++-- > > 1 file changed, 4 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/usb/host/xhci.c > b/drivers/usb/host/xhci.c index > > ca598aa..cb8a04b 100644 > > --- a/drivers/usb/host/xhci.c > > +++ b/drivers/usb/host/xhci.c > > @@ -941,10 +941,12 @@ static int _xhci_submit_control_msg(struct > > usb_device *udev, unsigned long pipe, if > (usb_pipedevice(pipe) == ctrl->rootdev) > > return xhci_submit_root(udev, pipe, buffer, setup); > > > > Hi! > What do you say we reorder the check a little: > > if ((setup->requesttype & USB_TYPE_MASK) == USB_TYPE_STANDARD) { > if (setup->request == USB_REQ_SET_ADDRESS) > return xhci_address_device(udev, root_portnr); > > if (setup->request == USB_REQ_SET_CONFIGURATION) > ... > } > > Also, I suspect this sort of fix needs to be applied to at > least dwc3 ep0.c, r8a66597-hcd.c and musb_hcd.c as well. > I don't have another board in my hand, so I can't verify the other xhci host controller. But I have confirmed this patch in xhci.c actually can fix errors while the the request type is USB_REQ_SET_ADDRESS or USB_REQ_SET_CONFIGURATION in USB vendor command. > Paging Hans so he can share his visdom too :) Hi Hans, Do you have any comments? Thanks > > > - if (setup->request == USB_REQ_SET_ADDRESS) > > + if (setup->request == USB_REQ_SET_ADDRESS && > > + (setup->requesttype & USB_TYPE_MASK) == USB_TYPE_STANDARD) > > return xhci_address_device(udev, root_portnr); > > > > - if (setup->request == USB_REQ_SET_CONFIGURATION) { > > + if (setup->request == USB_REQ_SET_CONFIGURATION && > > + (setup->requesttype & USB_TYPE_MASK) == USB_TYPE_STANDARD) { > > ret = xhci_set_configuration(udev); > > if (ret) { > > puts("Failed to configure xHCI endpoint\n"); > > Best regards, > Marek Vasut > > ------Please consider the environment before printing this e-mail. >
On Monday, January 25, 2016 at 12:11:59 PM, Ted wrote: > Hi Marek, Hi Ted, > > -----Original Message----- > > From: Marek Vasut [mailto:marex@denx.de] > > Sent: Thursday, November 26, 2015 9:25 AM > > To: Ted > > Cc: swarren@nvidia.com; u-boot@lists.denx.de; > > linux.amoon@gmail.com; Hans de Goede > > Subject: Re: [PATCH] usb: xhci: Fix vendor command error if > > the request type is USB_REQ_SET_ADDRESS or USB_REQ_SET_CONFIGURATION. > > > > On Wednesday, November 25, 2015 at 06:57:48 AM, Ted Chen wrote: > > > Add a condition of set_address and set_configuration to > > > > check if the > > > > > request is standardized. > > > > > > Signed-off-by: Ted Chen <tedchen@realtek.com> > > > --- > > > > > > drivers/usb/host/xhci.c | 6 ++++-- > > > 1 file changed, 4 insertions(+), 2 deletions(-) > > > > > > diff --git a/drivers/usb/host/xhci.c > > > > b/drivers/usb/host/xhci.c index > > > > > ca598aa..cb8a04b 100644 > > > --- a/drivers/usb/host/xhci.c > > > +++ b/drivers/usb/host/xhci.c > > > @@ -941,10 +941,12 @@ static int _xhci_submit_control_msg(struct > > > usb_device *udev, unsigned long pipe, if > > > > (usb_pipedevice(pipe) == ctrl->rootdev) > > > > > return xhci_submit_root(udev, pipe, buffer, setup); > > > > Hi! > > What do you say we reorder the check a little: > > > > if ((setup->requesttype & USB_TYPE_MASK) == USB_TYPE_STANDARD) { > > > > if (setup->request == USB_REQ_SET_ADDRESS) > > > > return xhci_address_device(udev, root_portnr); > > > > if (setup->request == USB_REQ_SET_CONFIGURATION) > > > > ... > > > > } > > > > Also, I suspect this sort of fix needs to be applied to at > > least dwc3 ep0.c, r8a66597-hcd.c and musb_hcd.c as well. > > I don't have another board in my hand, so I can't verify the other xhci > host controller. That's fine, just fixing this problem everywhere is enough and the people who have the controller can test it themselves. > But I have confirmed this patch in xhci.c actually can fix errors while > the the request type is USB_REQ_SET_ADDRESS or USB_REQ_SET_CONFIGURATION > in USB vendor command. Excellent. > > Paging Hans so he can share his visdom too :) > > Hi Hans, > > Do you have any comments? > > Thanks Thanks! > > > - if (setup->request == USB_REQ_SET_ADDRESS) > > > + if (setup->request == USB_REQ_SET_ADDRESS && > > > + (setup->requesttype & USB_TYPE_MASK) == USB_TYPE_STANDARD) > > > > > > return xhci_address_device(udev, root_portnr); > > > > > > - if (setup->request == USB_REQ_SET_CONFIGURATION) { > > > + if (setup->request == USB_REQ_SET_CONFIGURATION && > > > + (setup->requesttype & USB_TYPE_MASK) == USB_TYPE_STANDARD) { > > > > > > ret = xhci_set_configuration(udev); > > > if (ret) { > > > > > > puts("Failed to configure xHCI endpoint\n"); > > > > Best regards, > > Marek Vasut > > > > ------Please consider the environment before printing this e-mail.
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index ca598aa..cb8a04b 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -941,10 +941,12 @@ static int _xhci_submit_control_msg(struct usb_device *udev, unsigned long pipe, if (usb_pipedevice(pipe) == ctrl->rootdev) return xhci_submit_root(udev, pipe, buffer, setup); - if (setup->request == USB_REQ_SET_ADDRESS) + if (setup->request == USB_REQ_SET_ADDRESS && + (setup->requesttype & USB_TYPE_MASK) == USB_TYPE_STANDARD) return xhci_address_device(udev, root_portnr); - if (setup->request == USB_REQ_SET_CONFIGURATION) { + if (setup->request == USB_REQ_SET_CONFIGURATION && + (setup->requesttype & USB_TYPE_MASK) == USB_TYPE_STANDARD) { ret = xhci_set_configuration(udev); if (ret) { puts("Failed to configure xHCI endpoint\n");
Add a condition of set_address and set_configuration to check if the request is standardized. Signed-off-by: Ted Chen <tedchen@realtek.com> --- drivers/usb/host/xhci.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)