public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa@the-dreams.de>
To: Vignesh R <vigneshr@ti.com>
Cc: "Florian Fainelli" <f.fainelli@gmail.com>,
	linux-kernel@vger.kernel.org,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Felipe Balbi" <balbi@kernel.org>,
	"Peter Chen" <peter.chen@nxp.com>,
	"Roger Quadros" <rogerq@ti.com>,
	"Alan Stern" <stern@rowland.harvard.edu>,
	"Mathias Nyman" <mathias.nyman@linux.intel.com>,
	"Javier Martinez Canillas" <javier@osg.samsung.com>,
	"Baoyou Xie" <baoyou.xie@linaro.org>,
	"Sekhar Nori" <nsekhar@ti.com>,
	"William wu" <wulf@rock-chips.com>,
	"Arnd Bergmann" <arnd@arndb.de>,
	"Chris Bainbridge" <chris.bainbridge@gmail.com>,
	"Wolfram Sang" <wsa-dev@sang-engineering.com>,
	"Krzysztof Opasiak" <k.opasiak@samsung.com>,
	"Felix Hädicke" <felixhaedicke@web.de>,
	"Colin Ian King" <colin.king@canonical.com>,
	"open list:USB SUBSYSTEM" <linux-usb@vger.kernel.org>,
	clemens@ladisch.de, maksim.salau@gmail.com
Subject: Re: [PATCH v3 0/2] usb: Check for DMA capable buffer sanity
Date: Wed, 31 May 2017 17:12:37 +0200	[thread overview]
Message-ID: <20170531151237.GA2399@katana> (raw)
In-Reply-To: <dd2b5c78-4ed6-319a-9531-c0641af33a66@ti.com>

[-- Attachment #1: Type: text/plain, Size: 704 bytes --]


> > +/* only works in process context because of stack detection */
> > +static inline bool is_dma_capable_addr(void *addr)
> > +{
> > +	return !(is_vmalloc_or_module_addr(addr) ||
> > +		 object_is_on_stack(addr));
> 
> This does not catch kmap'ed buffers which are not directly DMA'able.
> I would suggest to use virt_addr_valid() instead. Something like:
> 
> 	return (virt_addr_valid(addr) && !object_is_on_stack(addr));

Hehe, here is the part of the commit message I have for this code:

===

Second note: I am not even sure the checks complete (kmapped mem?). But
that just strengthens the argument of having on centralized place IMO :)

===

So, thanks for the heads up!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2017-05-31 15:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-26  0:56 [PATCH v3 0/2] usb: Check for DMA capable buffer sanity Florian Fainelli
2017-04-26  0:56 ` [PATCH v3 1/2] usb: core: Check URB setup_packet and transfer_buffer sanity Florian Fainelli
2017-04-26  0:56 ` [PATCH v3 2/2] usb: udc: core: Error if req->buf is either from vmalloc or stack Florian Fainelli
2017-05-05 21:08 ` [PATCH v3 0/2] usb: Check for DMA capable buffer sanity Florian Fainelli
2017-05-28 16:03   ` Wolfram Sang
2017-05-31 11:04     ` David Laight
2017-05-31 11:55       ` Vignesh R
2017-05-31 15:50         ` Wolfram Sang
2017-05-31 19:23           ` Wolfram Sang
2017-05-31 11:56     ` Vignesh R
2017-05-31 15:12       ` Wolfram Sang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170531151237.GA2399@katana \
    --to=wsa@the-dreams.de \
    --cc=arnd@arndb.de \
    --cc=balbi@kernel.org \
    --cc=baoyou.xie@linaro.org \
    --cc=chris.bainbridge@gmail.com \
    --cc=clemens@ladisch.de \
    --cc=colin.king@canonical.com \
    --cc=f.fainelli@gmail.com \
    --cc=felixhaedicke@web.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=javier@osg.samsung.com \
    --cc=k.opasiak@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=maksim.salau@gmail.com \
    --cc=mathias.nyman@linux.intel.com \
    --cc=nsekhar@ti.com \
    --cc=peter.chen@nxp.com \
    --cc=rogerq@ti.com \
    --cc=stern@rowland.harvard.edu \
    --cc=vigneshr@ti.com \
    --cc=wsa-dev@sang-engineering.com \
    --cc=wulf@rock-chips.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox