Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 185231
b: refs/heads/master
c: f661c6f
h: refs/heads/master
i:
  185229: 649937a
  185227: aee3972
  185223: 4d8cfec
  185215: 557348b
v: v3
  • Loading branch information
Alan Stern authored and Greg Kroah-Hartman committed Mar 2, 2010
1 parent e17d733 commit 8e0237a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a91b0c502285fd0c569fae1222fdd945ef739233
refs/heads/master: f661c6f8c67bd55e93348f160d590ff9edf08904
6 changes: 4 additions & 2 deletions trunk/Documentation/usb/error-codes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ USB-specific:

-EFBIG Host controller driver can't schedule that many ISO frames.

-EPIPE Specified endpoint is stalled. For non-control endpoints,
reset this status with usb_clear_halt().
-EPIPE The pipe type specified in the URB doesn't match the
endpoint's actual type.

-EMSGSIZE (a) endpoint maxpacket size is zero; it is not usable
in the current interface altsetting.
Expand All @@ -60,6 +60,8 @@ USB-specific:

-EHOSTUNREACH URB was rejected because the device is suspended.

-ENOEXEC A control URB doesn't contain a Setup packet.


**************************************************************************
* Error codes returned by in urb->status *
Expand Down
22 changes: 13 additions & 9 deletions trunk/drivers/usb/core/devio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1104,13 +1104,25 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
case USB_ENDPOINT_XFER_CONTROL:
case USB_ENDPOINT_XFER_ISOC:
return -EINVAL;
/* allow single-shot interrupt transfers, at bogus rates */
case USB_ENDPOINT_XFER_INT:
/* allow single-shot interrupt transfers */
uurb->type = USBDEVFS_URB_TYPE_INTERRUPT;
goto interrupt_urb;
}
uurb->number_of_packets = 0;
if (uurb->buffer_length > MAX_USBFS_BUFFER_SIZE)
return -EINVAL;
break;

case USBDEVFS_URB_TYPE_INTERRUPT:
if (!usb_endpoint_xfer_int(&ep->desc))
return -EINVAL;
interrupt_urb:
uurb->number_of_packets = 0;
if (uurb->buffer_length > MAX_USBFS_BUFFER_SIZE)
return -EINVAL;
break;

case USBDEVFS_URB_TYPE_ISO:
/* arbitrary limit */
if (uurb->number_of_packets < 1 ||
Expand Down Expand Up @@ -1143,14 +1155,6 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
uurb->buffer_length = totlen;
break;

case USBDEVFS_URB_TYPE_INTERRUPT:
uurb->number_of_packets = 0;
if (!usb_endpoint_xfer_int(&ep->desc))
return -EINVAL;
if (uurb->buffer_length > MAX_USBFS_BUFFER_SIZE)
return -EINVAL;
break;

default:
return -EINVAL;
}
Expand Down
7 changes: 7 additions & 0 deletions trunk/drivers/usb/core/urb.c
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,13 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
{
unsigned int orig_flags = urb->transfer_flags;
unsigned int allowed;
static int pipetypes[4] = {
PIPE_CONTROL, PIPE_ISOCHRONOUS, PIPE_BULK, PIPE_INTERRUPT
};

/* Check that the pipe's type matches the endpoint's type */
if (usb_pipetype(urb->pipe) != pipetypes[xfertype])
return -EPIPE; /* The most suitable error code :-) */

/* enforce simple/standard policy */
allowed = (URB_NO_TRANSFER_DMA_MAP | URB_NO_SETUP_DMA_MAP |
Expand Down

0 comments on commit 8e0237a

Please sign in to comment.