netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yanmin Zhang <yanmin_zhang@linux.intel.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: David Miller <davem@davemloft.net>,
	kunx.jiang@intel.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ipv4: fix the rcu race between free_fib_info and ip_route_output_slow
Date: Wed, 23 May 2012 14:15:57 +0800	[thread overview]
Message-ID: <1337753757.14538.190.camel@ymzhang.sh.intel.com> (raw)
In-Reply-To: <1337749339.3361.1655.camel@edumazet-glaptop>

On Wed, 2012-05-23 at 07:02 +0200, Eric Dumazet wrote:
> On Wed, 2012-05-23 at 12:54 +0800, Yanmin Zhang wrote:
> 
> > > fi->fib_dev (aka fib_nh[0].nh_dev) need full RCU protection.
> > The new patch posted at https://lkml.org/lkml/2012/5/22/558 does move the
> > resetting to RCU protection.
> 
> Its not enough.
> 
> We must take care that all users are in a RCU protected region.
> 
> They might be already, but a full check is needed.
> 
> For example 
> 
> net/ipv4/fib_trie.c:2563:    fi->fib_dev ? fi->fib_dev->name : "*"
> 
> looks to be safe (because already in a rcu_read_lock())
> 
> But its not.
> 
> Right thing would be to do :
> 
> struct net_device *ndev = rcu_dereference(fi->fib_dev)
> 
> 	...
> 	ndev ? ndev->name : "*"
Thanks for the pointer.

Besides fi->fib_dev here, we need check fi->fib_hash, fi->fib_lhash,
and nexthop_nh->nh_hash.

Yanmin

  reply	other threads:[~2012-05-23  6:15 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-22  9:48 [PATCH] ipv4: fix the rcu race between free_fib_info and ip_route_output_slow kun.jiang
2012-05-22 19:15 ` David Miller
2012-05-23  3:02   ` Yanmin Zhang
2012-05-23  3:23     ` David Miller
2012-05-23  3:30       ` Yanmin Zhang
2012-05-23  3:49         ` David Miller
2012-05-23  4:41           ` Yanmin Zhang
2012-05-23  5:08             ` Eric Dumazet
2012-05-23  4:37       ` Eric Dumazet
2012-05-23  4:54         ` Yanmin Zhang
2012-05-23  5:02           ` Eric Dumazet
2012-05-23  6:15             ` Yanmin Zhang [this message]
2012-05-23  6:27               ` Eric Dumazet
2012-05-23  6:47                 ` Yanmin Zhang
2012-05-23  6:55                   ` Eric Dumazet
2012-05-23  7:13                     ` Eric Dumazet
2012-05-23  7:24                       ` Yanmin Zhang
2012-05-23  7:39                         ` Eric Dumazet
2012-05-23  7:41                           ` Eric Dumazet
2012-05-23  7:47                           ` Yanmin Zhang
2012-05-23  6:37             ` Eric Dumazet
2012-05-23  6:43               ` Eric Dumazet

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=1337753757.14538.190.camel@ymzhang.sh.intel.com \
    --to=yanmin_zhang@linux.intel.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=kunx.jiang@intel.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).