Skip to content

Commit

Permalink
netxen: Fix BUG "sleeping function called from invalid context"
Browse files Browse the repository at this point in the history
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: Mike Galbraith <umgwanakikbuti@gmail.com>
Signed-off-by: Manish Chopra <manish.chopra@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Manish Chopra authored and David S. Miller committed Sep 30, 2014
1 parent 705f1c8 commit 0d36882
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 2 additions & 0 deletions drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ void netxen_release_tx_buffers(struct netxen_adapter *adapter)
int i, j;
struct nx_host_tx_ring *tx_ring = adapter->tx_ring;

spin_lock(&adapter->tx_clean_lock);
cmd_buf = tx_ring->cmd_buf_arr;
for (i = 0; i < tx_ring->num_desc; i++) {
buffrag = cmd_buf->frag_array;
Expand All @@ -158,6 +159,7 @@ void netxen_release_tx_buffers(struct netxen_adapter *adapter)
}
cmd_buf++;
}
spin_unlock(&adapter->tx_clean_lock);
}

void netxen_free_sw_resources(struct netxen_adapter *adapter)
Expand Down
2 changes: 0 additions & 2 deletions drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1186,7 +1186,6 @@ __netxen_nic_down(struct netxen_adapter *adapter, struct net_device *netdev)
return;

smp_mb();
spin_lock(&adapter->tx_clean_lock);
netif_carrier_off(netdev);
netif_tx_disable(netdev);

Expand All @@ -1204,7 +1203,6 @@ __netxen_nic_down(struct netxen_adapter *adapter, struct net_device *netdev)
netxen_napi_disable(adapter);

netxen_release_tx_buffers(adapter);
spin_unlock(&adapter->tx_clean_lock);
}

/* Usage: During suspend and firmware recovery module */
Expand Down

0 comments on commit 0d36882

Please sign in to comment.