From: Stephen Hemminger <shemminger@linux-foundation.org>
To: David Miller <davem@davemloft.net>
Cc: a.p.zijlstra@chello.nl, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org, jdike@addtoit.com
Subject: Re: [PATCH] net: fix race in process_backlog
Date: Wed, 3 Oct 2007 15:05:19 -0700 [thread overview]
Message-ID: <20071003150519.1fd206a8@freepuppy.rosehill> (raw)
In-Reply-To: <20071003.145807.111205634.davem@davemloft.net>
On Wed, 03 Oct 2007 14:58:07 -0700 (PDT)
David Miller <davem@davemloft.net> wrote:
> From: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Date: Wed, 03 Oct 2007 17:44:53 +0200
>
> > Index: linux-2.6/net/core/dev.c
> > ===================================================================
> > --- linux-2.6.orig/net/core/dev.c
> > +++ linux-2.6/net/core/dev.c
> > @@ -2095,11 +2095,11 @@ static int process_backlog(struct napi_s
> >
> > local_irq_disable();
> > skb = __skb_dequeue(&queue->input_pkt_queue);
> > - local_irq_enable();
> > if (!skb) {
> > - napi_complete(napi);
> > + __napi_complete(napi);
> > break;
> > }
> > + local_irq_enable();
>
> What re-enables interrupts in the !skb path?
This looks like a better fix. the irq_enable is needed in both cases.
--- a/net/core/dev.c 2007-09-27 07:19:10.000000000 -0700
+++ b/net/core/dev.c 2007-10-03 15:03:54.000000000 -0700
@@ -2077,12 +2077,14 @@ static int process_backlog(struct napi_s
local_irq_disable();
skb = __skb_dequeue(&queue->input_pkt_queue);
- local_irq_enable();
if (!skb) {
- napi_complete(napi);
+ __napi_complete(napi);
+ local_irq_enable();
break;
}
+ local_irq_enable();
+
dev = skb->dev;
netif_receive_skb(skb);
--
Stephen Hemminger <shemminger@linux-foundation.org>
next prev parent reply other threads:[~2007-10-03 22:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-10-03 15:44 [PATCH] net: fix race in process_backlog Peter Zijlstra
2007-10-03 16:15 ` Stephen Hemminger
2007-10-03 21:58 ` David Miller
2007-10-03 22:05 ` Stephen Hemminger [this message]
2007-10-03 23:39 ` 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=20071003150519.1fd206a8@freepuppy.rosehill \
--to=shemminger@linux-foundation.org \
--cc=a.p.zijlstra@chello.nl \
--cc=davem@davemloft.net \
--cc=jdike@addtoit.com \
--cc=linux-kernel@vger.kernel.org \
--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