linux/drivers/usb/chipidea
Stephen Warren 3b9561e9d9 USB: set device dma_mask without reference to global data
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>
Acked-by: Tony Prisk <linux@prisktech.co.nz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-05-16 17:30:52 -07:00
..
bits.h usb: chipidea: add host role 2012-05-11 16:56:15 -07:00
ci13xxx_imx.c USB: set device dma_mask without reference to global data 2013-05-16 17:30:52 -07:00
ci13xxx_imx.h usb: chipidea: usbmisc: add post handling and errata fix for mx25 2013-03-30 08:13:58 -07:00
ci13xxx_msm.c usb: remove use of __devexit 2012-11-21 13:27:17 -08:00
ci13xxx_pci.c usb: chipidea: make pci platform datas static 2013-03-30 08:13:58 -07:00
ci.h usb: chipidea: udc: add the define TD_PAGE_COUNT and fix all users 2013-03-30 08:20:49 -07:00
core.c usb: chipidea: big-endian support 2013-03-30 08:20:47 -07:00
debug.c usb: chipidea: fix precedence bug in ci_requests_show() 2013-03-30 08:08:40 -07:00
debug.h usb: chipidea: convert debug entries in sysfs to debugfs 2013-03-30 08:08:39 -07:00
host.c usb: chipidea: Allow disabling streaming not only in udc mode 2013-01-11 16:01:07 -08:00
host.h usb: chipidea: add host role 2012-05-11 16:56:15 -07:00
Kconfig usb, chipidea: fix link error when USB_EHCI_HCD is a module 2013-05-16 17:28:27 -07:00
Makefile usb: chipidea: usbmisc: rename file, struct and functions to usbmisc_imx 2013-03-30 08:13:57 -07:00
udc.c usb: patches for v3.10 merge window 2013-04-05 15:18:00 -07:00
udc.h usb: chipidea: udc: fix memory access of shared memory on armv5 machines 2013-04-05 13:43:14 -07:00
usbmisc_imx.c usb: chipidea: usbmisc: add post handling and errata fix for mx25 2013-03-30 08:13:58 -07:00