Commit 0d368820 authored by Manish Chopra's avatar Manish Chopra Committed by David S. Miller

netxen: Fix BUG "sleeping function called from invalid context"

o __netxen_nic_down() function might sleep while holding spinlock_t(tx_clean_lock).
  Acquire this lock for only releasing TX buffers instead of taking it
  for whole down path.
Reported-by: default avatarMike Galbraith <umgwanakikbuti@gmail.com>
Signed-off-by: default avatarManish Chopra <manish.chopra@qlogic.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 705f1c86
...@@ -135,6 +135,7 @@ void netxen_release_tx_buffers(struct netxen_adapter *adapter) ...@@ -135,6 +135,7 @@ void netxen_release_tx_buffers(struct netxen_adapter *adapter)
int i, j; int i, j;
struct nx_host_tx_ring *tx_ring = adapter->tx_ring; struct nx_host_tx_ring *tx_ring = adapter->tx_ring;
spin_lock(&adapter->tx_clean_lock);
cmd_buf = tx_ring->cmd_buf_arr; cmd_buf = tx_ring->cmd_buf_arr;
for (i = 0; i < tx_ring->num_desc; i++) { for (i = 0; i < tx_ring->num_desc; i++) {
buffrag = cmd_buf->frag_array; buffrag = cmd_buf->frag_array;
...@@ -158,6 +159,7 @@ void netxen_release_tx_buffers(struct netxen_adapter *adapter) ...@@ -158,6 +159,7 @@ void netxen_release_tx_buffers(struct netxen_adapter *adapter)
} }
cmd_buf++; cmd_buf++;
} }
spin_unlock(&adapter->tx_clean_lock);
} }
void netxen_free_sw_resources(struct netxen_adapter *adapter) void netxen_free_sw_resources(struct netxen_adapter *adapter)
......
...@@ -1186,7 +1186,6 @@ __netxen_nic_down(struct netxen_adapter *adapter, struct net_device *netdev) ...@@ -1186,7 +1186,6 @@ __netxen_nic_down(struct netxen_adapter *adapter, struct net_device *netdev)
return; return;
smp_mb(); smp_mb();
spin_lock(&adapter->tx_clean_lock);
netif_carrier_off(netdev); netif_carrier_off(netdev);
netif_tx_disable(netdev); netif_tx_disable(netdev);
...@@ -1204,7 +1203,6 @@ __netxen_nic_down(struct netxen_adapter *adapter, struct net_device *netdev) ...@@ -1204,7 +1203,6 @@ __netxen_nic_down(struct netxen_adapter *adapter, struct net_device *netdev)
netxen_napi_disable(adapter); netxen_napi_disable(adapter);
netxen_release_tx_buffers(adapter); netxen_release_tx_buffers(adapter);
spin_unlock(&adapter->tx_clean_lock);
} }
/* Usage: During suspend and firmware recovery module */ /* Usage: During suspend and firmware recovery module */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment