linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: joonwpark81@gmail.com
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] [NET]: Fix Ooops of napi net_rx_action.
Date: Tue, 11 Dec 2007 02:32:18 -0800 (PST)	[thread overview]
Message-ID: <20071211.023218.31965443.davem@davemloft.net> (raw)
In-Reply-To: <001801c83bd6$2001d410$9c94fea9@jason>

From: "Joonwoo Park" <joonwpark81@gmail.com>
Date: Tue, 11 Dec 2007 18:13:34 +0900

Joonwoo-ssi annyoung haseyo,

> [NET]: Fix Ooops of napi net_rx_action.
> Before doing list_move_tail napi poll_list, it should be ensured
> 
> Signed-off-by: Joonwoo Park <joonwpark81@gmail.com>
> ---
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 86d6261..74bd5ab 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -2207,7 +2207,8 @@ static void net_rx_action(struct softirq_action *h)
>  		 * still "owns" the NAPI instance and therefore can
>  		 * move the instance around on the list at-will.
>  		 */
> -		if (unlikely(work == weight))
> +		if (unlikely((test_bit(NAPI_STATE_SCHED, &n->state))
> +				&& (work == weight)))
>  			list_move_tail(&n->poll_list, list);
>  
>  		netpoll_poll_unlock(have);

How can the NAPI_STATE_SCHED bit be cleared externally yet we take
this list_move_tail() code path?

If NAPI_STATE_SCHED is cleared, work will be zero which will never be
equal to 'weight', and this we'll never attempt the list_move_tail().

If something clears NAPI_STATE_SCHED meanwhile, we have a serious race
and your patch is an incomplete bandaid.  For example, if it can
happen, then a case like:

		if (test_bit(NAPI_STATE_SCHED, &n->state))
	... something clears NAPI_STATE_SCHED right now ...
			work = n->poll(n, weight);

can crash too.

  reply	other threads:[~2007-12-11 10:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-11  9:13 [PATCH] [NET]: Fix Ooops of napi net_rx_action Joonwoo Park
2007-12-11 10:32 ` David Miller [this message]
2007-12-11 12:36   ` Herbert Xu
2007-12-11 12:41     ` David Miller
2007-12-11 12:57   ` Joonwoo Park
2007-12-11 23:12     ` Brandeburg, Jesse
2007-12-11 23:27       ` Joonwoo Park
2007-12-11 23:42         ` Stephen Hemminger
2007-12-16 21:35           ` David Miller
2007-12-12  0:12       ` Joonwoo Park
2007-12-12  0:38         ` Brandeburg, Jesse
2007-12-12 15:12           ` 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=20071211.023218.31965443.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=joonwpark81@gmail.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;
as well as URLs for NNTP newsgroup(s).