Index: usb-devel/drivers/usb/core/urb.c =================================================================== --- usb-devel.orig/drivers/usb/core/urb.c +++ usb-devel/drivers/usb/core/urb.c @@ -199,15 +199,27 @@ static const int pipetypes[4] = { * given urb. It returns 0 if the urb contains a valid endpoint, otherwise * a negative error code. */ +unsigned int alan_pipe, alan_epaddr, alan_epattr; int usb_urb_ep_type_check(const struct urb *urb) { const struct usb_host_endpoint *ep; + unsigned int pipe, epattr; - ep = usb_pipe_endpoint(urb->dev, urb->pipe); - if (!ep) + pipe = READ_ONCE(urb->pipe); + ep = usb_pipe_endpoint(urb->dev, pipe); + if (!ep) { + alan_pipe = pipe; + alan_epattr = 0; + alan_epaddr = 0xff; return -EINVAL; - if (usb_pipetype(urb->pipe) != pipetypes[usb_endpoint_type(&ep->desc)]) + } + epattr = READ_ONCE(ep->desc.bmAttributes); + if (usb_pipetype(pipe) != pipetypes[epattr & USB_ENDPOINT_XFERTYPE_MASK]) { + alan_pipe = pipe; + alan_epattr = epattr; + alan_epaddr = ep->desc.bEndpointAddress; return -EINVAL; + } return 0; } EXPORT_SYMBOL_GPL(usb_urb_ep_type_check); @@ -475,8 +487,9 @@ int usb_submit_urb(struct urb *urb, gfp_ /* Check that the pipe's type matches the endpoint's type */ if (usb_urb_ep_type_check(urb)) - dev_WARN(&dev->dev, "BOGUS urb xfer, pipe %x != type %x\n", - usb_pipetype(urb->pipe), pipetypes[xfertype]); + dev_WARN(&dev->dev, "BOGUS urb xfer, pipe %x != type %x, pipe 0x%x, ep attr 0x%02x, ep addr 0x%02x\n", + usb_pipetype(urb->pipe), pipetypes[xfertype], + alan_pipe, alan_epattr, alan_epaddr); /* Check against a simple/standard policy */ allowed = (URB_NO_TRANSFER_DMA_MAP | URB_NO_INTERRUPT | URB_DIR_MASK |