Jarek and Thibaut,
Thank you both very much for your work finding and fixing this bug.
Jarek, can you verify that the following patch fixes the problem you
were seeing?
-Dale
----- Patch follows -----
From: Dale Farnsworth <[EMAIL PROTECTED]>
mv643xx_eth: Fix race condition in mv643xx_eth_free_tx_descs
The bug was found and isolated by Thibaut VARENE <[EMAIL PROTECTED]>
and Jarek Poplawski <[EMAIL PROTECTED]>. This patch is a modification of their
fixes. We acquire and release the lock for each descriptor that is freed
to minimize the time the lock is held.
---
drivers/net/mv643xx_eth.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
index c41ae42..0d32381 100644
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -314,6 +314,13 @@ int mv643xx_eth_free_tx_descs(struct net
while (mp->tx_desc_count > 0) {
spin_lock_irqsave(&mp->lock, flags);
+
+ /* maybe tx_desc_count changed before the lock was acquired */
+ if (mp->tx_desc_count <= 0) {
+ spin_unlock_irqrestore(&mp->lock, flags);
+ return released;
+ }
+
tx_index = mp->tx_used_desc_q;
desc = &mp->p_tx_desc_area[tx_index];
cmd_sts = desc->cmd_sts;
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html