All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Xin Long <lucien.xin@gmail.com>
Cc: network dev <netdev@vger.kernel.org>,
	davem@davemloft.net, hannes@stressinduktion.org
Subject: Re: [PATCH net] route: add rcu_read_lock when lookup route and update fnhe in __ip_do_redirect
Date: Mon, 01 Feb 2016 05:46:47 -0800	[thread overview]
Message-ID: <1454334407.7627.163.camel@edumazet-glaptop2.roam.corp.google.com> (raw)
In-Reply-To: <db60649416c596fc5e76930484b726cb180b14b8.1454322132.git.lucien.xin@gmail.com>

On Mon, 2016-02-01 at 18:22 +0800, Xin Long wrote:

> But there may be an issue in __ip_do_redirect():
>          } else {
>              if (fib_lookup(net, fl4, &res, 0) == 0) {
>                  struct fib_nh *nh = &FIB_RES_NH(res);
> 
>                  update_or_create_fnhe(nh, fl4->daddr, new_gw,
>                                0, 0);
>              }
> 
> Which is not running in rcu_read_lock(), it may update a fnhe that
> has been freed.
> 
> So fix it by adding rcu_read_lock() just like other parts.

But the whole __ip_do_redirect() needs to be called from rcu_read_lock()
already.

No need to add another rcu_read_lock() around fib_lookup()

How did you come doing this patch ? Any particular stack dump or
something ?

  reply	other threads:[~2016-02-01 13:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-01 10:22 [PATCH net] route: add rcu_read_lock when lookup route and update fnhe in __ip_do_redirect Xin Long
2016-02-01 13:46 ` Eric Dumazet [this message]
2016-02-01 17:16   ` Xin Long
2016-02-01 17:49     ` Eric Dumazet
2016-02-01 18:14       ` Xin Long

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=1454334407.7627.163.camel@edumazet-glaptop2.roam.corp.google.com \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=hannes@stressinduktion.org \
    --cc=lucien.xin@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.