diff options
author | Javi Merino <javi.merino@arm.com> | 2011-10-18 06:50:07 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-10-22 17:11:23 -0400 |
commit | ee3f615819404a9438b2dd01b7a39f276d2737f2 (patch) | |
tree | 8b725dfe99118faef327d163cf02a5fff28d8bf4 /arch | |
parent | b55fa18817743c3c4aef14f0c6fc0e21d7bc1e62 (diff) |
ARM: 7136/1: pl330: Fix a race condition
If two requests have been submitted and one of them is running, if you
call pl330_chan_ctrl(ch_id, PL330_OP_START), there's a window of time
between the spin_lock_irqsave() and the _state() check in which the
running transaction may finish. In that case, we don't receive the
interrupt (because they are disabled), but _start() sees that the DMA
is stopped, so it starts it. The problem is that it sends the
transaction that has just finished again, because pl330_update()
hasn't mark it as done yet.
This patch fixes this race condition by not calling _start() if the
DMA is already executing transactions. When interrupts are reenabled,
pl330_update() will call _start().
Reference: <1317892206-3600-1-git-send-email-javi.merino@arm.com>
Signed-off-by: Javi Merino <javi.merino@arm.com>
Acked-by: Jassi Brar <jassi.brar@samsung.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/common/pl330.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/arm/common/pl330.c b/arch/arm/common/pl330.c index 97912fa48782..7129cfbdacd6 100644 --- a/arch/arm/common/pl330.c +++ b/arch/arm/common/pl330.c | |||
@@ -1546,7 +1546,7 @@ int pl330_chan_ctrl(void *ch_id, enum pl330_chan_op op) | |||
1546 | 1546 | ||
1547 | /* Start the next */ | 1547 | /* Start the next */ |
1548 | case PL330_OP_START: | 1548 | case PL330_OP_START: |
1549 | if (!_start(thrd)) | 1549 | if (!_thrd_active(thrd) && !_start(thrd)) |
1550 | ret = -EIO; | 1550 | ret = -EIO; |
1551 | break; | 1551 | break; |
1552 | 1552 | ||