Commit cdab23b7 authored by Sathya Perla's avatar Sathya Perla Committed by David S. Miller

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: default avatarSathya Perla <sathyap@serverengines.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a8e9179a
...@@ -1010,7 +1010,7 @@ static void be_rx_q_clean(struct be_adapter *adapter) ...@@ -1010,7 +1010,7 @@ static void be_rx_q_clean(struct be_adapter *adapter)
/* Then free posted rx buffer that were not used */ /* Then free posted rx buffer that were not used */
tail = (rxq->head + rxq->len - atomic_read(&rxq->used)) % rxq->len; tail = (rxq->head + rxq->len - atomic_read(&rxq->used)) % rxq->len;
for (; tail != rxq->head; index_inc(&tail, rxq->len)) { for (; atomic_read(&rxq->used) > 0; index_inc(&tail, rxq->len)) {
page_info = get_rx_page_info(adapter, tail); page_info = get_rx_page_info(adapter, tail);
put_page(page_info->page); put_page(page_info->page);
memset(page_info, 0, sizeof(*page_info)); memset(page_info, 0, sizeof(*page_info));
......
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