diff options
| author | Dale Farnsworth <dale@farnsworth.org> | 2006-01-27 03:02:05 -0500 |
|---|---|---|
| committer | Jeff Garzik <jgarzik@pobox.com> | 2006-01-27 11:09:24 -0500 |
| commit | c7cd9014e6ea620bf9e1b52a22fadd7618b53276 (patch) | |
| tree | 4cf3c30c2c035934c6c25388462e7c2f2f904a59 | |
| parent | efd51b5c6798d103e3aa683464aebb2019b62119 (diff) | |
[PATCH] mv643xx_eth: Fix spinlock recursion bug
This patch eliminates a spinlock recursion bug introduced recently.
Since eth_port_send() is always called with the lock held, we simply
remove the locking inside the function itself.
Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
| -rw-r--r-- | drivers/net/mv643xx_eth.c | 13 |
1 files changed, 0 insertions, 13 deletions
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index 40ae36b20c9d..9eeb8db10af9 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
| @@ -2617,7 +2617,6 @@ static ETH_FUNC_RET_STATUS eth_port_send(struct mv643xx_private *mp, | |||
| 2617 | struct eth_tx_desc *current_descriptor; | 2617 | struct eth_tx_desc *current_descriptor; |
| 2618 | struct eth_tx_desc *first_descriptor; | 2618 | struct eth_tx_desc *first_descriptor; |
| 2619 | u32 command; | 2619 | u32 command; |
| 2620 | unsigned long flags; | ||
| 2621 | 2620 | ||
| 2622 | /* Do not process Tx ring in case of Tx ring resource error */ | 2621 | /* Do not process Tx ring in case of Tx ring resource error */ |
| 2623 | if (mp->tx_resource_err) | 2622 | if (mp->tx_resource_err) |
| @@ -2634,8 +2633,6 @@ static ETH_FUNC_RET_STATUS eth_port_send(struct mv643xx_private *mp, | |||
| 2634 | return ETH_ERROR; | 2633 | return ETH_ERROR; |
| 2635 | } | 2634 | } |
| 2636 | 2635 | ||
| 2637 | spin_lock_irqsave(&mp->lock, flags); | ||
| 2638 | |||
| 2639 | mp->tx_ring_skbs++; | 2636 | mp->tx_ring_skbs++; |
| 2640 | BUG_ON(mp->tx_ring_skbs > mp->tx_ring_size); | 2637 | BUG_ON(mp->tx_ring_skbs > mp->tx_ring_size); |
| 2641 | 2638 | ||
| @@ -2685,15 +2682,11 @@ static ETH_FUNC_RET_STATUS eth_port_send(struct mv643xx_private *mp, | |||
| 2685 | mp->tx_resource_err = 1; | 2682 | mp->tx_resource_err = 1; |
| 2686 | mp->tx_curr_desc_q = tx_first_desc; | 2683 | mp->tx_curr_desc_q = tx_first_desc; |
| 2687 | 2684 | ||
| 2688 | spin_unlock_irqrestore(&mp->lock, flags); | ||
| 2689 | |||
| 2690 | return ETH_QUEUE_LAST_RESOURCE; | 2685 | return ETH_QUEUE_LAST_RESOURCE; |
| 2691 | } | 2686 | } |
| 2692 | 2687 | ||
| 2693 | mp->tx_curr_desc_q = tx_next_desc; | 2688 | mp->tx_curr_desc_q = tx_next_desc; |
| 2694 | 2689 | ||
| 2695 | spin_unlock_irqrestore(&mp->lock, flags); | ||
| 2696 | |||
| 2697 | return ETH_OK; | 2690 | return ETH_OK; |
| 2698 | } | 2691 | } |
| 2699 | #else | 2692 | #else |
| @@ -2704,14 +2697,11 @@ static ETH_FUNC_RET_STATUS eth_port_send(struct mv643xx_private *mp, | |||
| 2704 | int tx_desc_used; | 2697 | int tx_desc_used; |
| 2705 | struct eth_tx_desc *current_descriptor; | 2698 | struct eth_tx_desc *current_descriptor; |
| 2706 | unsigned int command_status; | 2699 | unsigned int command_status; |
| 2707 | unsigned long flags; | ||
| 2708 | 2700 | ||
| 2709 | /* Do not process Tx ring in case of Tx ring resource error */ | 2701 | /* Do not process Tx ring in case of Tx ring resource error */ |
| 2710 | if (mp->tx_resource_err) | 2702 | if (mp->tx_resource_err) |
| 2711 | return ETH_QUEUE_FULL; | 2703 | return ETH_QUEUE_FULL; |
| 2712 | 2704 | ||
| 2713 | spin_lock_irqsave(&mp->lock, flags); | ||
| 2714 | |||
| 2715 | mp->tx_ring_skbs++; | 2705 | mp->tx_ring_skbs++; |
| 2716 | BUG_ON(mp->tx_ring_skbs > mp->tx_ring_size); | 2706 | BUG_ON(mp->tx_ring_skbs > mp->tx_ring_size); |
| 2717 | 2707 | ||
| @@ -2742,12 +2732,9 @@ static ETH_FUNC_RET_STATUS eth_port_send(struct mv643xx_private *mp, | |||
| 2742 | /* Check for ring index overlap in the Tx desc ring */ | 2732 | /* Check for ring index overlap in the Tx desc ring */ |
| 2743 | if (tx_desc_curr == tx_desc_used) { | 2733 | if (tx_desc_curr == tx_desc_used) { |
| 2744 | mp->tx_resource_err = 1; | 2734 | mp->tx_resource_err = 1; |
| 2745 | |||
| 2746 | spin_unlock_irqrestore(&mp->lock, flags); | ||
| 2747 | return ETH_QUEUE_LAST_RESOURCE; | 2735 | return ETH_QUEUE_LAST_RESOURCE; |
| 2748 | } | 2736 | } |
| 2749 | 2737 | ||
| 2750 | spin_unlock_irqrestore(&mp->lock, flags); | ||
| 2751 | return ETH_OK; | 2738 | return ETH_OK; |
| 2752 | } | 2739 | } |
| 2753 | #endif | 2740 | #endif |
