usb: core: Remove redundant vmap checks

Now that the vmap area checks are being performed in the DMA
infrastructure directly, there is no need to repeat them in USB.

Signed-off-by: Kees Cook <keescook@chromium.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
Kees Cook 2019-10-29 14:34:23 -07:00 committed by Christoph Hellwig
parent ca66536845
commit b3d53f5fce
1 changed files with 1 additions and 7 deletions

View File

@ -1410,10 +1410,7 @@ int usb_hcd_map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb,
if (hcd->self.uses_pio_for_control) if (hcd->self.uses_pio_for_control)
return ret; return ret;
if (hcd_uses_dma(hcd)) { if (hcd_uses_dma(hcd)) {
if (is_vmalloc_addr(urb->setup_packet)) { if (object_is_on_stack(urb->setup_packet)) {
WARN_ONCE(1, "setup packet is not dma capable\n");
return -EAGAIN;
} else if (object_is_on_stack(urb->setup_packet)) {
WARN_ONCE(1, "setup packet is on stack\n"); WARN_ONCE(1, "setup packet is on stack\n");
return -EAGAIN; return -EAGAIN;
} }
@ -1479,9 +1476,6 @@ int usb_hcd_map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb,
ret = -EAGAIN; ret = -EAGAIN;
else else
urb->transfer_flags |= URB_DMA_MAP_PAGE; 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 if (object_is_on_stack(urb->transfer_buffer)) { } else if (object_is_on_stack(urb->transfer_buffer)) {
WARN_ONCE(1, "transfer buffer is on stack\n"); WARN_ONCE(1, "transfer buffer is on stack\n");
ret = -EAGAIN; ret = -EAGAIN;