Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6
* 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6: mv643xx_eth: Fix race condition in mv643xx_eth_free_tx_descs s2io bogus memset
This commit is contained in:
@@ -314,6 +314,13 @@ int mv643xx_eth_free_tx_descs(struct net_device *dev, int force)
|
|||||||
|
|
||||||
while (mp->tx_desc_count > 0) {
|
while (mp->tx_desc_count > 0) {
|
||||||
spin_lock_irqsave(&mp->lock, flags);
|
spin_lock_irqsave(&mp->lock, flags);
|
||||||
|
|
||||||
|
/* tx_desc_count might have changed before acquiring the lock */
|
||||||
|
if (mp->tx_desc_count <= 0) {
|
||||||
|
spin_unlock_irqrestore(&mp->lock, flags);
|
||||||
|
return released;
|
||||||
|
}
|
||||||
|
|
||||||
tx_index = mp->tx_used_desc_q;
|
tx_index = mp->tx_used_desc_q;
|
||||||
desc = &mp->p_tx_desc_area[tx_index];
|
desc = &mp->p_tx_desc_area[tx_index];
|
||||||
cmd_sts = desc->cmd_sts;
|
cmd_sts = desc->cmd_sts;
|
||||||
@@ -332,13 +339,13 @@ int mv643xx_eth_free_tx_descs(struct net_device *dev, int force)
|
|||||||
if (skb)
|
if (skb)
|
||||||
mp->tx_skb[tx_index] = NULL;
|
mp->tx_skb[tx_index] = NULL;
|
||||||
|
|
||||||
spin_unlock_irqrestore(&mp->lock, flags);
|
|
||||||
|
|
||||||
if (cmd_sts & ETH_ERROR_SUMMARY) {
|
if (cmd_sts & ETH_ERROR_SUMMARY) {
|
||||||
printk("%s: Error in TX\n", dev->name);
|
printk("%s: Error in TX\n", dev->name);
|
||||||
mp->stats.tx_errors++;
|
mp->stats.tx_errors++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
spin_unlock_irqrestore(&mp->lock, flags);
|
||||||
|
|
||||||
if (cmd_sts & ETH_TX_FIRST_DESC)
|
if (cmd_sts & ETH_TX_FIRST_DESC)
|
||||||
dma_unmap_single(NULL, addr, count, DMA_TO_DEVICE);
|
dma_unmap_single(NULL, addr, count, DMA_TO_DEVICE);
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user