提交 ed6f1353 编写于 作者: A Amit Kumar Salecha 提交者: David S. Miller

qlcnic: fix rcv buffer leak

Rcv producer value should be read in spin-lock.
Signed-off-by: NAmit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 ade91f8e
...@@ -1554,9 +1554,10 @@ qlcnic_post_rx_buffers(struct qlcnic_adapter *adapter, u32 ringid, ...@@ -1554,9 +1554,10 @@ qlcnic_post_rx_buffers(struct qlcnic_adapter *adapter, u32 ringid,
int producer, count = 0; int producer, count = 0;
struct list_head *head; struct list_head *head;
spin_lock(&rds_ring->lock);
producer = rds_ring->producer; producer = rds_ring->producer;
spin_lock(&rds_ring->lock);
head = &rds_ring->free_list; head = &rds_ring->free_list;
while (!list_empty(head)) { while (!list_empty(head)) {
...@@ -1578,13 +1579,13 @@ qlcnic_post_rx_buffers(struct qlcnic_adapter *adapter, u32 ringid, ...@@ -1578,13 +1579,13 @@ qlcnic_post_rx_buffers(struct qlcnic_adapter *adapter, u32 ringid,
producer = get_next_index(producer, rds_ring->num_desc); producer = get_next_index(producer, rds_ring->num_desc);
} }
spin_unlock(&rds_ring->lock);
if (count) { if (count) {
rds_ring->producer = producer; rds_ring->producer = producer;
writel((producer-1) & (rds_ring->num_desc-1), writel((producer-1) & (rds_ring->num_desc-1),
rds_ring->crb_rcv_producer); rds_ring->crb_rcv_producer);
} }
spin_unlock(&rds_ring->lock);
} }
static void static void
...@@ -1596,10 +1597,11 @@ qlcnic_post_rx_buffers_nodb(struct qlcnic_adapter *adapter, ...@@ -1596,10 +1597,11 @@ qlcnic_post_rx_buffers_nodb(struct qlcnic_adapter *adapter,
int producer, count = 0; int producer, count = 0;
struct list_head *head; struct list_head *head;
producer = rds_ring->producer;
if (!spin_trylock(&rds_ring->lock)) if (!spin_trylock(&rds_ring->lock))
return; return;
producer = rds_ring->producer;
head = &rds_ring->free_list; head = &rds_ring->free_list;
while (!list_empty(head)) { while (!list_empty(head)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册