From: Sathya Perla <sathyap@serverengines.com>
To: netdev <netdev@vger.kernel.org>
Subject: [net-next-2.6 PATCH 2/3] be2net: fix bad queue traversal in be_rx_q_clean()
Date: Mon, 10 Aug 2009 19:13:23 +0530 [thread overview]
Message-ID: <20090810134323.GA10857@serverengines.com> (raw)
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>
---
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 f7f8660..49c17ed 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)
/* 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));
--
1.6.0.4
next reply other threads:[~2009-08-10 13:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-10 13:43 Sathya Perla [this message]
2009-08-13 5:16 ` [net-next-2.6 PATCH 2/3] be2net: fix bad queue traversal in be_rx_q_clean() David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090810134323.GA10857@serverengines.com \
--to=sathyap@serverengines.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox