diff options
author | Amit Kumar Salecha <amit.salecha@qlogic.com> | 2010-04-22 02:51:40 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-04-22 15:28:30 -0700 |
commit | ed6f1353e195b4432e251667b2d84d766d07c79c (patch) | |
tree | c3431005c6e541dd65f23a8af7a7eb16b3ee4d8f | |
parent | ade91f8ec92da43b62b0efaa854cfd4b5ec0c0c9 (diff) | |
download | linux-ed6f1353e195b4432e251667b2d84d766d07c79c.tar.bz2 |
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>
-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, int producer, count = 0; struct list_head *head; + spin_lock(&rds_ring->lock); + producer = rds_ring->producer; - spin_lock(&rds_ring->lock); head = &rds_ring->free_list; while (!list_empty(head)) { @@ -1578,13 +1579,13 @@ qlcnic_post_rx_buffers(struct qlcnic_adapter *adapter, u32 ringid, producer = get_next_index(producer, rds_ring->num_desc); } - spin_unlock(&rds_ring->lock); if (count) { rds_ring->producer = producer; writel((producer-1) & (rds_ring->num_desc-1), rds_ring->crb_rcv_producer); } + spin_unlock(&rds_ring->lock); } static void @@ -1596,10 +1597,11 @@ qlcnic_post_rx_buffers_nodb(struct qlcnic_adapter *adapter, int producer, count = 0; struct list_head *head; - producer = rds_ring->producer; if (!spin_trylock(&rds_ring->lock)) return; + producer = rds_ring->producer; + head = &rds_ring->free_list; while (!list_empty(head)) { |