Subject: Re: [PATCH] Re: kernel BUG in eth_alloc_tx_desc_index at drivers/net/mv643xx_eth.c:1069!

From: Jarek Poplawski <[email-masked]>
Date: Tue, 23 Jan 2007 09:17:09 +0100

On Mon, Jan 22, 2007 at 10:06:16AM -0700, Dale Farnsworth wrote:
> 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

Sorry, only Thibaut can verify this. I don't have
such card.

I can only confirm that your patch fixes unproper
locking of mp->tx_desc_count in the while condition.
But I'm not sure your way is optimal now because
mp->tx_desc_count is checked 2 times per every loop.
I think it is right only if you know the function
mv643xx_eth_free_tx_descs is called mostly while 
mp->tx_desc_count == 0 or 1.

> ----- Patch follows -----
> 
> From: Dale Farnsworth <[email-masked]>
> 
> mv643xx_eth: Fix race condition in mv643xx_eth_free_tx_descs
> 
> The bug was found and isolated by Thibaut VARENE <[email-masked]>
> and Jarek Poplawski <[email-masked]>.  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.
> 
> ---

From: Dale Farnsworth <[email-masked]>
 
mv643xx_eth: Fix race condition in mv643xx_eth_free_tx_descs
 
The bug was found and isolated by Thibaut VARENE <[email-masked]>
and Jarek Poplawski <[email-masked]> noticed a locking problem.  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.
 
---

I did small adjustment of my role here.

Regards,
Jarek P.