linux/drivers/usb/musb
Vikram Pandita abf710e655 usb: musb: handle nuked ep dma interrupt
User can trigger disabling of gadget at run time while the
transfers are going on.
Eg: 1: rmmod of musb driver while transfers are going on

Eg: 2: On android doing:
 echo 0       > /sys/class/android_usb/android0/enable
While a big file transfer is going on via PTP/MTP.

In such a case, musb_gadget_disable() calls nuke()
but the dma interrupt may still happen for an endpoint since hw
would raise the interrupt in anycase.

This can result in a NULL pointer access crash:

[  314.030426] PC is at txstate+0x74/0x20c
[  314.034759] LR is at musb_g_tx+0x140/0x204
[  314.039489] pc : [<c03506f4>]    lr : [<c0350bcc>]    psr: 20000193
[  314.039520] sp : c783bc68  ip : 00000002  fp : c783bc9c
[  314.052429] r10: 00000018  r9 : 00000000  r8 : 00000200
[  314.058258] r7 : 00000000  r6 : fc0ab130  r5 : c781a410  r4 : c6caf640
[  314.065643] r3 : 00000000  r2 : 00000000  r1 : 00000000  r0 : c781a000
[  315.083251] Backtrace:
[  315.086242] [<c0350680>] (txstate+0x0/0x20c) from [<c0350bcc>] (musb_g_tx+0x140/0x204)
[  315.095123] [<c0350a8c>] (musb_g_tx+0x0/0x204) from [<c034eb00>] (musb_dma_completion+0x40/0x54)
[  315.104980] [<c034eac0>] (musb_dma_completion+0x0/0x54) from [<c0351e6c>] (dma_controller_irq+0x118/0x184)
[  315.115661] [<c0351d54>] (dma_controller_irq+0x0/0x184) from [<c00d86b8>] (handle_irq_event_percpu+0x54/0x188)

So put protection in code to handle possiblity of getting an interrupt for an
endpoint that might have been already nuked.

Reported-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Vikram Pandita <vikram.pandita@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
2012-06-04 18:29:04 +03:00
..
am35x.c Here we have a big rework done by Heikki Krogerus (thanks) which 2012-03-01 08:45:33 -08:00
blackfin.c Here we have a big rework done by Heikki Krogerus (thanks) which 2012-03-01 08:45:33 -08:00
blackfin.h usb: musb: drop a gigantic amount of ifdeferry 2011-07-01 14:31:10 -07:00
cppi_dma.c usb: musb: cppi: add missing include to fix compilation 2012-05-14 12:45:45 -07:00
cppi_dma.h
da8xx.c Here we have a big rework done by Heikki Krogerus (thanks) which 2012-03-01 08:45:33 -08:00
davinci.c usb: musb: davinci.c: add missing unregister 2012-04-18 13:50:54 +03:00
davinci.h
Kconfig usb: musb: enable support for am335x 2012-05-04 13:59:35 +03:00
Makefile usb: musb: Add support for ti81xx platform 2012-05-04 13:59:34 +03:00
musb_core.c usb: musb: Add support for ti81xx platform 2012-05-04 13:59:34 +03:00
musb_core.h usb: musb: drop __deprecated flag 2012-04-18 13:49:20 +03:00
musb_debug.h usb: musb: remove extern qualifier from musb_debug.h header 2011-12-21 13:21:02 +02:00
musb_debugfs.c usb: musb: debugfs: fix error check 2012-02-01 11:02:46 +02:00
musb_dma.h usb: musb: introduce api for dma code to check compatibility with usb request 2011-02-01 10:41:30 +02:00
musb_dsps.c usb: musb: Add support for ti81xx platform 2012-05-04 13:59:34 +03:00
musb_gadget_ep0.c usb: musb: headers cleanup 2011-12-12 11:51:52 +02:00
musb_gadget.c usb: musb: handle nuked ep dma interrupt 2012-06-04 18:29:04 +03:00
musb_gadget.h usb: musb: gadget: do not poke with gadget's list_head 2011-02-17 21:11:46 +02:00
musb_host.c usb: musb: fix bug in musb_cleanup_urb 2012-04-10 19:11:48 +03:00
musb_host.h usb: musb: drop a gigantic amount of ifdeferry 2011-07-01 14:31:10 -07:00
musb_io.h m68k: Make sure {read,write}s[bwl]() are always defined 2012-04-22 20:16:50 +02:00
musb_regs.h usb: musb: tusb6010: fix compilation 2011-08-12 11:52:50 +03:00
musb_virthub.c usb: musb: Start using struct usb_otg 2012-02-13 13:52:54 +02:00
musbhsdma.c USB: irq: Remove IRQF_DISABLED 2011-09-18 01:39:36 -07:00
musbhsdma.h Merge branches 'devel-cleanup', 'devel-board', 'devel-early-init' and 'devel-ti816x' into omap-for-linus 2011-02-16 11:32:38 -08:00
omap2430.c usb: musb: omap: fix the error check for pm_runtime_get_sync 2012-04-10 19:11:50 +03:00
omap2430.h USB: musb: get rid of omap_readl/writel 2010-03-02 14:54:38 -08:00
tusb6010_omap.c usb: musb: tusb6010: fix compilation 2011-08-12 11:52:50 +03:00
tusb6010.c Here we have a big rework done by Heikki Krogerus (thanks) which 2012-03-01 08:45:33 -08:00
tusb6010.h
ux500_dma.c dmaengine/dma_slave: introduce inline wrappers 2012-03-21 19:20:22 +05:30
ux500.c Here we have a big rework done by Heikki Krogerus (thanks) which 2012-03-01 08:45:33 -08:00