lkml.org 
[lkml]   [2017]   [Apr]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] usb: core: Warn if an URB's transfer_buffer is on stack
On Sun, 23 Apr 2017, Florian Fainelli wrote:

> > In that case, it would be better to move the warning to a central place
> > where it will always get triggered, such as map_urb_for_dma(). As it
> > is, the patch will only issue a warning for callers of usb_bulk_msg(),
> > usb_interrupt_msg(), or usb_control_msg().
>
> map_urb_for_dma() seems like a better location indeed, let me submit a
> v2 with that then.
>
> Most HCDs implementation that define a map_urb_for_dma function pointer
> also call usb_hcd_map_urb_for_dma() (except for max3421-hcd.c) so would
> it be better to move the is_object_on_stack() check in
> usb_hcd_map_urb_for_dma() for consistency with the existing
> is_vmalloc_addr() check?

Or maybe move the is_vmalloc_addr() check to map_urb_for_dma().

The only issue is that some weird HCD might sometimes not need to do
the DMA mapping (it might use PIO for some types of transfer). In
those cases we don't want to issue the warning. So perhaps
usb_hcd_map_urb_for_dma() would be better for both checks.

Alan Stern

\
 
 \ /
  Last update: 2017-04-24 02:03    [W:0.033 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site