mmc: mxcmmc: fix race conditions for host->req and host->data access
authorAnatolij Gustschin <agust@denx.de>
Mon, 8 Apr 2013 21:28:05 +0000 (23:28 +0200)
committerChris Ball <cjb@laptop.org>
Fri, 12 Apr 2013 19:13:13 +0000 (15:13 -0400)
mxcmci_dma_callback() is invoked by DMA drivers in soft-irq
context and can be interrupted by the mxcmci_irq() interrupt
which can finish the mmc request or data transfer and set
host->req or host->data pointers to NULL. Then mxcmci_data_done()
crashes with a null pointer dereferences. Protect all accesses
to host->req and host->data by spin locks.

Also check host->data pointer in mxcmci_watchdog() before
dereferencing it.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Chris Ball <cjb@laptop.org>

No differences found