[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070122170615.GA15293@xyzzy.farnsworth.org>
Date: Mon, 22 Jan 2007 10:06:16 -0700
From: "Dale Farnsworth" <dale@...nsworth.org>
To: Jarek Poplawski <jarkao2@...pl>
Cc: Thibaut VARENE <T-Bone@...isc-linux.org>, netdev@...r.kernel.org,
mlachwani@...sta.com
Subject: Re: [PATCH] Re: kernel BUG in eth_alloc_tx_desc_index at drivers/net/mv643xx_eth.c:1069!
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 <dale@...nsworth.org>
mv643xx_eth: Fix race condition in mv643xx_eth_free_tx_descs
The bug was found and isolated by Thibaut VARENE <T-Bone@...isc-linux.org>
and Jarek Poplawski <jarkao2@...pl>. 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 majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists