aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorYoshii Takashi <takashi.yoshii.zj@renesas.com>2012-03-14 16:14:43 +0900
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-04-02 09:27:22 -0700
commitc2de397f51b5a149dacfe2678ac232d422498774 (patch)
treeb178d80053d16fcd0fe5e95759a5a9c5541558c9 /drivers/pci
parent8bb8ebe7b77228209006ea945104e37294608b93 (diff)
downloadkernel_samsung_smdk4412-c2de397f51b5a149dacfe2678ac232d422498774.zip
kernel_samsung_smdk4412-c2de397f51b5a149dacfe2678ac232d422498774.tar.gz
kernel_samsung_smdk4412-c2de397f51b5a149dacfe2678ac232d422498774.tar.bz2
serial: sh-sci: fix a race of DMA submit_tx on transfer
commit 49d4bcaddca977fffdea8b0b71f6e5da96dac78e upstream. When DMA is enabled, sh-sci transfer begins with uart_start() sci_start_tx() if (cookie_tx < 0) schedule_work() Then, starts DMA when wq scheduled, -- (A) process_one_work() work_fn_rx() cookie_tx = desc->submit_tx() And finishes when DMA transfer ends, -- (B) sci_dma_tx_complete() async_tx_ack() cookie_tx = -EINVAL (possible another schedule_work()) This A to B sequence is not reentrant, since controlling variables (for example, cookie_tx above) are not queues nor lists. So, they must be invoked as A B A B..., otherwise results in kernel crash. To ensure the sequence, sci_start_tx() seems to test if cookie_tx < 0 (represents "not used") to call schedule_work(). But cookie_tx will not be set (to a cookie, also means "used") until in the middle of work queue scheduled function work_fn_tx(). This gap between the test and set allows the breakage of the sequence under the very frequently call of uart_start(). Another gap between async_tx_ack() and another schedule_work() results in the same issue, too. This patch introduces a new condition "cookie_tx == 0" just to mark it is "busy" and assign it within spin-locked region to fill the gaps. Signed-off-by: Takashi Yoshii <takashi.yoshii.zj@renesas.com> Reviewed-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> Signed-off-by: Paul Mundt <lethal@linux-sh.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/pci')
0 files changed, 0 insertions, 0 deletions