mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marin Mitov <mitov@issp.bas.bg>
To: linux-kernel@vger.kernel.org
Cc: Jeff Garzik <jgarzik@pobox.com>
Subject: guard against buggy poll() return value
Date: Sat, 8 Mar 2008 11:10:51 +0200	[thread overview]
Message-ID: <200803081110.52126.mitov@issp.bas.bg> (raw)

Hi all,

Looking in net/core/dev.c I see:

WARN_ON_ONCE(work > weight);

which is a guard against buggy net drivers returning
more work from their poll method than they should.

Few lines bellow a check is done:

if (unlikely(work == weight)) 

which excludes the buggy outcome. 
Should not it be changed to:

if (unlikely(work >= weight)) 

If you find it worth, here is a patch against 2.6.24.3.

Regards.

Marin Mitov

Signed-off-by: Marin Mitov <mitov@issp.bas.bg>
-------------------------------------------
--- a/net/core/dev.c	2008-03-08 10:37:50.000000000 +0200
+++ b/net/core/dev.c	2008-03-08 10:39:09.000000000 +0200
@@ -2207,7 +2207,7 @@ static void net_rx_action(struct softirq
 		 * still "owns" the NAPI instance and therefore can
 		 * move the instance around on the list at-will.
 		 */
-		if (unlikely(work == weight)) {
+		if (unlikely(work >= weight)) {
 			if (unlikely(napi_disable_pending(n)))
 				__napi_complete(n);
 			else


                 reply	other threads:[~2008-03-08  9:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=200803081110.52126.mitov@issp.bas.bg \
    --to=mitov@issp.bas.bg \
    --cc=jgarzik@pobox.com \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®