[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.44L0.1704231958580.4937-100000@netrider.rowland.org>
Date: Sun, 23 Apr 2017 20:03:05 -0400 (EDT)
From: Alan Stern <stern@...land.harvard.edu>
To: Florian Fainelli <f.fainelli@...il.com>
cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
<linux-kernel@...r.kernel.org>, <arnd@...db.de>,
<maksim.salau@...il.com>, David Mosberger <davidm@...uge.net>,
Roger Quadros <rogerq@...com>,
Wolfram Sang <wsa-dev@...g-engineering.com>,
Oliver Neukum <oneukum@...e.com>,
Jaejoong Kim <climbbb.kim@...il.com>,
"open list:USB SUBSYSTEM" <linux-usb@...r.kernel.org>
Subject: Re: [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
Powered by blists - more mailing lists