[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1f64fcfb-10b0-0407-8f6e-86f94601003f@ladisch.de>
Date: Mon, 24 Apr 2017 09:15:55 +0200
From: Clemens Ladisch <clemens@...isch.de>
To: Florian Fainelli <f.fainelli@...il.com>,
linux-kernel@...r.kernel.org
Cc: arnd@...db.de, maksim.salau@...il.com,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Alan Stern <stern@...land.harvard.edu>,
Mathias Nyman <mathias.nyman@...ux.intel.com>,
Peter Chen <peter.chen@....com>, Roger Quadros <rogerq@...com>,
Baoyou Xie <baoyou.xie@...aro.org>,
Sekhar Nori <nsekhar@...com>,
Chris Bainbridge <chris.bainbridge@...il.com>,
Wolfram Sang <wsa-dev@...g-engineering.com>,
"open list:USB SUBSYSTEM" <linux-usb@...r.kernel.org>
Subject: Re: [PATCH v2] usb: core: Warn if an URB's transfer_buffer is on
stack
Florian Fainelli wrote:
> We see a large number of fixes to several drivers to remove the usage of
> on-stack buffers feeding into USB transfer functions. Make it easier to spot
> the offenders by adding a warning in usb_hcd_map_urb_for_dma() checking that
> urb->transfer_buffer is not a stack object.
This description is incomplete.
> + } else if (object_is_on_stack(urb->transfer_buffer)) {
> + WARN_ONCE(1, "transfer buffer is on stack\n");
> + ret = -EAGAIN;
> } else {
> urb->transfer_dma = dma_map_single(
Not only is there a warning, but the check also forces all those URBs
to abort with an error.
Well, that makes it even easier to spot the offenders ...
Regards,
Clemens
Powered by blists - more mailing lists