Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1163621AbdDXADP (ORCPT ); Sun, 23 Apr 2017 20:03:15 -0400 Received: from netrider.rowland.org ([192.131.102.5]:55039 "HELO netrider.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1163598AbdDXADG (ORCPT ); Sun, 23 Apr 2017 20:03:06 -0400 Date: Sun, 23 Apr 2017 20:03:05 -0400 (EDT) From: Alan Stern X-X-Sender: stern@netrider.rowland.org To: Florian Fainelli cc: Greg Kroah-Hartman , , , , David Mosberger , Roger Quadros , Wolfram Sang , Oliver Neukum , Jaejoong Kim , "open list:USB SUBSYSTEM" Subject: Re: [PATCH] usb: core: Warn if an URB's transfer_buffer is on stack In-Reply-To: <0fbe7fe9-b1ae-407d-c670-bcca43de46f1@gmail.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1046 Lines: 24 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