Skip to content

Commit

Permalink
usb: catch attempts to submit urbs with a vmalloc'd transfer buffer
Browse files Browse the repository at this point in the history
Save someone else the debug cycles of figuring out why a driver's
transfer request is failing or causing undefined system behavior.
Buffers submitted for dma must come from GFP allocated / DMA-able
memory.

Return -EAGAIN matching the return value for dma_mapping_error() cases.

Acked-by: Alan Stern <[email protected]>
Cc: Sarah Sharp <[email protected]>
Cc: Mathias Nyman <[email protected]>
Signed-off-by: Dan Williams <[email protected]>
Signed-off-by: Mathias Nyman <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
djbw authored and gregkh committed May 20, 2014
1 parent 654a55d commit 29d2fef
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/usb/core/hcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1502,6 +1502,9 @@ int usb_hcd_map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb,
ret = -EAGAIN;
else
urb->transfer_flags |= URB_DMA_MAP_PAGE;
} else if (is_vmalloc_addr(urb->transfer_buffer)) {
WARN_ONCE(1, "transfer buffer not dma capable\n");
ret = -EAGAIN;
} else {
urb->transfer_dma = dma_map_single(
hcd->self.controller,
Expand Down

0 comments on commit 29d2fef

Please sign in to comment.