Skip to content
Commit 26eed9a5 authored by Linus Walleij's avatar Linus Walleij Committed by Russell King
Browse files

[ARM] 5022/1: Race in ARM MMCI PL18x driver, V2



Updated version of 4446/1. This also drops the suggested comparison
of host_remain for == 0, since that doesn't make sense (still works
for us, too). We have verified that this patch solve race problems
on atleast 2 archs at high frequencies.

(Verbatim copy of old patch text below.)

The patch below fixes a race condition in the ARM MMCI PL18x driver.

If new data arrives in the FIFO while existing data is being read then
we get a second iteration of the loop in mmci_pio_read.

However host->size is not updated until after mmci_pio_read returns,
so we get count = number of new bytes PLUS number of bytes already
copied in the first iteration. This results in a FIFO underrun as
we try and read mode data than is available.

The fix is to compensating for data read on previous iterations
when calculating the amount of data in the FIFO.

Signed-off-by: default avatarLinus Walleij <triad@df.lth.se>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 136eb955
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment