From: gregkh@linuxfoundation•org (Greg Kroah-Hartman)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH] USB: set device dma_mask without reference to global data
Date: Tue, 7 May 2013 16:04:45 -0700 [thread overview]
Message-ID: <20130507230445.GC9105@kroah.com> (raw)
In-Reply-To: <1367967232-10128-1-git-send-email-swarren@wwwdotorg.org>
On Tue, May 07, 2013 at 04:53:52PM -0600, Stephen Warren wrote:
> From: Stephen Warren <swarren@nvidia•com>
>
> Many USB host drivers contain code such as:
>
> if (!pdev->dev.dma_mask)
> pdev->dev.dma_mask = &tegra_ehci_dma_mask;
>
> ... where tegra_ehci_dma_mask is a global. I suspect this code originated
> in commit 4a53f4e "USB: ehci-tegra: add probing through device tree" and
> was simply copied everywhere else.
>
> This works fine when the code is built-in, but can cause a crash when the
> code is in a module. The first module load sets up the dma_mask pointer,
> but if the module is removed and re-inserted, the value is now non-NULL,
> and hence is not updated to point at the new location, and hence points
> at a stale location within the previous module load address, which in
> turn causes a crash if the pointer is de-referenced.
>
> The simplest way of solving this seems to be to copy the code from
> ehci-platform.c, which uses the coherent_dma_mask as the target for the
> dma_mask pointer.
>
> Suggested-by: Arnd Bergmann <arnd@arndb•de>
> Signed-off-by: Stephen Warren <swarren@nvidia•com>
So this needs to go in for 3.10, right? Any older kernels as well? If
so, which ones?
thanks,
greg k-h
next prev parent reply other threads:[~2013-05-07 23:04 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-07 22:53 [PATCH] USB: set device dma_mask without reference to global data Stephen Warren
2013-05-07 23:04 ` Greg Kroah-Hartman [this message]
2013-05-07 23:42 ` Arnd Bergmann
2013-05-08 14:14 ` Alan Stern
2013-05-08 15:10 ` Arnd Bergmann
2013-05-09 21:33 ` Russell King - ARM Linux
2013-05-08 1:13 ` Peter Chen
2013-05-08 2:26 ` Stephen Warren
2013-05-08 2:54 ` Peter Chen
2013-05-08 7:11 ` Matthijs Kooijman
2013-05-08 7:28 ` Matthijs Kooijman
2013-05-08 13:50 ` Rob Herring
2013-05-08 14:07 ` Arnd Bergmann
2013-05-08 7:24 ` Arnd Bergmann
2013-05-09 21:39 ` Russell King - ARM Linux
2013-05-08 22:42 ` Stephen Warren
2013-05-09 21:36 ` Russell King - ARM Linux
2013-05-08 5:11 ` Tony Prisk
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=20130507230445.GC9105@kroah.com \
--to=gregkh@linuxfoundation$(echo .)org \
--cc=linux-arm-kernel@lists$(echo .)infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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