aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/netxen/netxen_nic_hw.c
diff options
context:
space:
mode:
authorDhananjay Phadke <dhananjay@netxen.com>2009-05-05 15:05:06 -0400
committerDavid S. Miller <davem@davemloft.net>2009-05-06 18:33:35 -0400
commit22527864ed7ee6c50f3c4d4b03c83c963caf5c0b (patch)
tree074c3dce3fe61b54aec6c7d8a829c4fa7592a6c0 /drivers/net/netxen/netxen_nic_hw.c
parent78a658d9720ce1b3dd71af3ee6d207ca751a48f5 (diff)
netxen: fix race in tx ring acccess
Fix the distance check between tx ring producer and consumer that could lead to tx ring wrap around. Signed-off-by: Dhananjay Phadke <dhananjay@netxen.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/netxen/netxen_nic_hw.c')
-rw-r--r--drivers/net/netxen/netxen_nic_hw.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/netxen/netxen_nic_hw.c b/drivers/net/netxen/netxen_nic_hw.c
index 9f5ced3eaf9d..23c974a7e0e4 100644
--- a/drivers/net/netxen/netxen_nic_hw.c
+++ b/drivers/net/netxen/netxen_nic_hw.c
@@ -526,7 +526,7 @@ netxen_send_cmd_descs(struct netxen_adapter *adapter,
526 producer = tx_ring->producer; 526 producer = tx_ring->producer;
527 consumer = tx_ring->sw_consumer; 527 consumer = tx_ring->sw_consumer;
528 528
529 if (nr_desc > find_diff_among(producer, consumer, tx_ring->num_desc)) { 529 if (nr_desc >= find_diff_among(producer, consumer, tx_ring->num_desc)) {
530 netif_tx_unlock_bh(adapter->netdev); 530 netif_tx_unlock_bh(adapter->netdev);
531 return -EBUSY; 531 return -EBUSY;
532 } 532 }
@@ -752,7 +752,7 @@ int netxen_linkevent_request(struct netxen_adapter *adapter, int enable)
752 752
753 word = NX_NIC_H2C_OPCODE_GET_LINKEVENT | ((u64)adapter->portnum << 16); 753 word = NX_NIC_H2C_OPCODE_GET_LINKEVENT | ((u64)adapter->portnum << 16);
754 req.req_hdr = cpu_to_le64(word); 754 req.req_hdr = cpu_to_le64(word);
755 req.words[0] = cpu_to_le64(enable); 755 req.words[0] = cpu_to_le64(enable | (enable << 8));
756 756
757 rv = netxen_send_cmd_descs(adapter, (struct cmd_desc_type0 *)&req, 1); 757 rv = netxen_send_cmd_descs(adapter, (struct cmd_desc_type0 *)&req, 1);
758 if (rv != 0) { 758 if (rv != 0) {