diff options
author | Sathya Perla <sathyap@serverengines.com> | 2009-08-09 23:43:23 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-08-13 01:13:17 -0400 |
commit | cdab23b7017693c00dd69fa28bcdf5b0434b3838 (patch) | |
tree | 2956d92941909e436bfaca87474025fadd519d1d /drivers | |
parent | a8e9179a7de196d37410fd3e9528081f22c70a4e (diff) |
be2net: fix bad queue traversal in be_rx_q_clean()
Using "for(tail != head)" to traverse a queue from tail to head
fails in the case of a fully filled queue. Use "for(used != 0)" instead.
Signed-off-by: Sathya Perla <sathyap@serverengines.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/benet/be_main.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c index acce6a639324..9bbf447ee28f 100644 --- a/drivers/net/benet/be_main.c +++ b/drivers/net/benet/be_main.c | |||
@@ -1010,7 +1010,7 @@ static void be_rx_q_clean(struct be_adapter *adapter) | |||
1010 | 1010 | ||
1011 | /* Then free posted rx buffer that were not used */ | 1011 | /* Then free posted rx buffer that were not used */ |
1012 | tail = (rxq->head + rxq->len - atomic_read(&rxq->used)) % rxq->len; | 1012 | tail = (rxq->head + rxq->len - atomic_read(&rxq->used)) % rxq->len; |
1013 | for (; tail != rxq->head; index_inc(&tail, rxq->len)) { | 1013 | for (; atomic_read(&rxq->used) > 0; index_inc(&tail, rxq->len)) { |
1014 | page_info = get_rx_page_info(adapter, tail); | 1014 | page_info = get_rx_page_info(adapter, tail); |
1015 | put_page(page_info->page); | 1015 | put_page(page_info->page); |
1016 | memset(page_info, 0, sizeof(*page_info)); | 1016 | memset(page_info, 0, sizeof(*page_info)); |