Skip to content

Commit

Permalink
be2net: fix bad queue traversal in be_rx_q_clean()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sathya Perla authored and David S. Miller committed Aug 13, 2009
1 parent a8e9179 commit cdab23b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/benet/be_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1010,7 +1010,7 @@ static void be_rx_q_clean(struct be_adapter *adapter)

/* Then free posted rx buffer that were not used */
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);
put_page(page_info->page);
memset(page_info, 0, sizeof(*page_info));
Expand Down

0 comments on commit cdab23b

Please sign in to comment.