From: Tony Prisk <linux-ci5G2KO2hbZ+pU9mqzGVBQ@public.gmane.org>
To: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
Cc: Greg Kroah-Hartman
<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>,
Alexander Shishkin
<alexander.shishkin-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>,
Alan Stern
<stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org>,
linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>,
Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH] USB: set device dma_mask without reference to global data
Date: Wed, 08 May 2013 17:11:25 +1200 [thread overview]
Message-ID: <5189DE7D.7060205@prisktech.co.nz> (raw)
In-Reply-To: <1367967232-10128-1-git-send-email-swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
On 08/05/13 10:53, Stephen Warren wrote:
> From: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
>
> 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-r2nGTMty4D4@public.gmane.org>
> Signed-off-by: Stephen Warren <swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
> ---
In the case of uhci-platform you would be absolutely correct. I copied the
example from tegra when we first had the problem on arch-vt8500.Because we
have no NAND support yet, I have always booted myrootfs from USB so it's
always been builtin and the problem wasnever a problem. The same problem
would
have existed on ehci-vt8500 but Arnd replaced it with ehci-platform due to
the multiplatform issues.
for uhci-platform.c
Acked-by: Tony Prisk <linux-ci5G2KO2hbZ+pU9mqzGVBQ@public.gmane.org>
Regards
Tony P
WARNING: multiple messages have this Message-ID (diff)
From: linux@prisktech.co.nz (Tony Prisk)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] USB: set device dma_mask without reference to global data
Date: Wed, 08 May 2013 17:11:25 +1200 [thread overview]
Message-ID: <5189DE7D.7060205@prisktech.co.nz> (raw)
In-Reply-To: <1367967232-10128-1-git-send-email-swarren@wwwdotorg.org>
On 08/05/13 10:53, 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>
> ---
In the case of uhci-platform you would be absolutely correct. I copied the
example from tegra when we first had the problem on arch-vt8500.Because we
have no NAND support yet, I have always booted myrootfs from USB so it's
always been builtin and the problem wasnever a problem. The same problem
would
have existed on ehci-vt8500 but Arnd replaced it with ehci-platform due to
the multiplatform issues.
for uhci-platform.c
Acked-by: Tony Prisk <linux@prisktech.co.nz>
Regards
Tony P
next prev parent reply other threads:[~2013-05-08 5:11 UTC|newest]
Thread overview: 36+ 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 22:53 ` Stephen Warren
2013-05-08 1:13 ` Peter Chen
2013-05-08 1:13 ` Peter Chen
2013-05-08 2:26 ` Stephen Warren
2013-05-08 2:26 ` Stephen Warren
2013-05-08 2:54 ` Peter Chen
2013-05-08 2:54 ` Peter Chen
[not found] ` <CAL411-pY_i19otiE2pLux6eR_OFHhfhK=+6BF=H6wABDsGCP6Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-05-08 7:11 ` Matthijs Kooijman
2013-05-08 7:11 ` Matthijs Kooijman
[not found] ` <20130508071137.GM25742-tJobPqrNDpleFRaWBN1JIYg6o0x57dKM8/qWW+O4k6E@public.gmane.org>
2013-05-08 7:28 ` Matthijs Kooijman
2013-05-08 7:28 ` Matthijs Kooijman
2013-05-08 13:50 ` Rob Herring
2013-05-08 13:50 ` Rob Herring
[not found] ` <518A582C.8070600-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2013-05-08 14:07 ` Arnd Bergmann
2013-05-08 14:07 ` Arnd Bergmann
2013-05-08 7:24 ` Arnd Bergmann
2013-05-08 7:24 ` Arnd Bergmann
[not found] ` <201305080924.44622.arnd-r2nGTMty4D4@public.gmane.org>
2013-05-09 21:39 ` Russell King - ARM Linux
2013-05-09 21:39 ` Russell King - ARM Linux
2013-05-08 22:42 ` Stephen Warren
2013-05-08 22:42 ` Stephen Warren
2013-05-09 21:36 ` Russell King - ARM Linux
2013-05-09 21:36 ` Russell King - ARM Linux
[not found] ` <1367967232-10128-1-git-send-email-swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2013-05-07 23:04 ` Greg Kroah-Hartman
2013-05-07 23:04 ` Greg Kroah-Hartman
[not found] ` <20130507230445.GC9105-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2013-05-07 23:42 ` Arnd Bergmann
2013-05-07 23:42 ` Arnd Bergmann
[not found] ` <201305080142.12025.arnd-r2nGTMty4D4@public.gmane.org>
2013-05-08 14:14 ` Alan Stern
2013-05-08 14:14 ` Alan Stern
[not found] ` <Pine.LNX.4.44L0.1305081011480.1450-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2013-05-08 15:10 ` Arnd Bergmann
2013-05-08 15:10 ` Arnd Bergmann
2013-05-09 21:33 ` Russell King - ARM Linux
2013-05-09 21:33 ` Russell King - ARM Linux
2013-05-08 5:11 ` Tony Prisk [this message]
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=5189DE7D.7060205@prisktech.co.nz \
--to=linux-ci5g2ko2hbz+pu9mqzgvbq@public.gmane.org \
--cc=alexander.shishkin-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
--cc=arnd-r2nGTMty4D4@public.gmane.org \
--cc=balbi-l0cyMroinI0@public.gmane.org \
--cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org \
--cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
--cc=swarren-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.