diff options
author | Amit Kumar Salecha <amit.salecha@qlogic.com> | 2010-04-21 22:51:40 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-04-22 18:28:30 -0400 |
commit | ed6f1353e195b4432e251667b2d84d766d07c79c (patch) | |
tree | c3431005c6e541dd65f23a8af7a7eb16b3ee4d8f /drivers | |
parent | ade91f8ec92da43b62b0efaa854cfd4b5ec0c0c9 (diff) |
qlcnic: fix rcv buffer leak
Rcv producer value should be read in spin-lock.
Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/qlcnic/qlcnic_init.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/net/qlcnic/qlcnic_init.c b/drivers/net/qlcnic/qlcnic_init.c index 9ef9f58f84dd..1b621ca13e25 100644 --- a/drivers/net/qlcnic/qlcnic_init.c +++ b/drivers/net/qlcnic/qlcnic_init.c | |||
@@ -1554,9 +1554,10 @@ qlcnic_post_rx_buffers(struct qlcnic_adapter *adapter, u32 ringid, | |||
1554 | int producer, count = 0; | 1554 | int producer, count = 0; |
1555 | struct list_head *head; | 1555 | struct list_head *head; |
1556 | 1556 | ||
1557 | spin_lock(&rds_ring->lock); | ||
1558 | |||
1557 | producer = rds_ring->producer; | 1559 | producer = rds_ring->producer; |
1558 | 1560 | ||
1559 | spin_lock(&rds_ring->lock); | ||
1560 | head = &rds_ring->free_list; | 1561 | head = &rds_ring->free_list; |
1561 | while (!list_empty(head)) { | 1562 | while (!list_empty(head)) { |
1562 | 1563 | ||
@@ -1578,13 +1579,13 @@ qlcnic_post_rx_buffers(struct qlcnic_adapter *adapter, u32 ringid, | |||
1578 | 1579 | ||
1579 | producer = get_next_index(producer, rds_ring->num_desc); | 1580 | producer = get_next_index(producer, rds_ring->num_desc); |
1580 | } | 1581 | } |
1581 | spin_unlock(&rds_ring->lock); | ||
1582 | 1582 | ||
1583 | if (count) { | 1583 | if (count) { |
1584 | rds_ring->producer = producer; | 1584 | rds_ring->producer = producer; |
1585 | writel((producer-1) & (rds_ring->num_desc-1), | 1585 | writel((producer-1) & (rds_ring->num_desc-1), |
1586 | rds_ring->crb_rcv_producer); | 1586 | rds_ring->crb_rcv_producer); |
1587 | } | 1587 | } |
1588 | spin_unlock(&rds_ring->lock); | ||
1588 | } | 1589 | } |
1589 | 1590 | ||
1590 | static void | 1591 | static void |
@@ -1596,10 +1597,11 @@ qlcnic_post_rx_buffers_nodb(struct qlcnic_adapter *adapter, | |||
1596 | int producer, count = 0; | 1597 | int producer, count = 0; |
1597 | struct list_head *head; | 1598 | struct list_head *head; |
1598 | 1599 | ||
1599 | producer = rds_ring->producer; | ||
1600 | if (!spin_trylock(&rds_ring->lock)) | 1600 | if (!spin_trylock(&rds_ring->lock)) |
1601 | return; | 1601 | return; |
1602 | 1602 | ||
1603 | producer = rds_ring->producer; | ||
1604 | |||
1603 | head = &rds_ring->free_list; | 1605 | head = &rds_ring->free_list; |
1604 | while (!list_empty(head)) { | 1606 | while (!list_empty(head)) { |
1605 | 1607 | ||