]> git.karo-electronics.de Git - karo-tx-linux.git/commit
firewire: ohci: fix race in AR split packet handling
authorClemens Ladisch <clemens@ladisch.de>
Mon, 25 Oct 2010 09:42:20 +0000 (11:42 +0200)
committerAndi Kleen <ak@linux.intel.com>
Tue, 14 Dec 2010 22:40:09 +0000 (23:40 +0100)
commit48059b90318aff5a2578d5a1d10ea7ac76e03e18
tree6ded9eec8e0e63d82c6425c625dfa8e26b697f43
parent329ad1cf88c3007e095a304028d11021eae8d402
firewire: ohci: fix race in AR split packet handling

commit a1f805e5e73a8fe166b71c6592d3837df0cd5e2e upstream.

When handling an AR buffer that has been completely filled, we assumed
that its descriptor will not be read by the controller and can be
overwritten.  However, when the last received packet happens to end at
the end of the buffer, the controller might not yet have moved on to the
next buffer and might read the branch address later.  If we overwrite
and free the page before that, the DMA context will either go dead
because of an invalid Z value, or go off into some random memory.

To fix this, ensure that the descriptor does not get overwritten by
using only the actual buffer instead of the entire page for reassembling
the split packet.  Furthermore, to avoid freeing the page too early,
move on to the next buffer only when some data in it guarantees that the
controller has moved on.

This should eliminate the remaining firewire-net problems.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Tested-by: Maxim Levitsky <maximlevitsky@gmail.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
drivers/firewire/ohci.c