Commit 2227bae2 authored by Amit Kumar Salecha's avatar Amit Kumar Salecha Committed by David S. Miller

netxen: fix rcv buffer leak

Rcv producer should be read in spin-lock.
Signed-off-by: default avatarAmit Kumar Salecha <amit.salecha@qlogic.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bf445080
...@@ -1805,9 +1805,10 @@ netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ringid, ...@@ -1805,9 +1805,10 @@ netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ringid,
netxen_ctx_msg msg = 0; netxen_ctx_msg msg = 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)) {
...@@ -1829,7 +1830,6 @@ netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ringid, ...@@ -1829,7 +1830,6 @@ netxen_post_rx_buffers(struct netxen_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;
...@@ -1853,6 +1853,8 @@ netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ringid, ...@@ -1853,6 +1853,8 @@ netxen_post_rx_buffers(struct netxen_adapter *adapter, u32 ringid,
NETXEN_RCV_PRODUCER_OFFSET), msg); NETXEN_RCV_PRODUCER_OFFSET), msg);
} }
} }
spin_unlock(&rds_ring->lock);
} }
static void static void
...@@ -1864,10 +1866,11 @@ netxen_post_rx_buffers_nodb(struct netxen_adapter *adapter, ...@@ -1864,10 +1866,11 @@ netxen_post_rx_buffers_nodb(struct netxen_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%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment