Netdev List
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: idosch@mellanox.com
Cc: netdev@vger.kernel.org, alexander.h.duyck@intel.com,
	dsahern@gmail.com, fengguang.wu@intel.com, mlxsw@mellanox.com
Subject: Re: [PATCH net v3] ipv4: Fix use-after-free when flushing FIB tables
Date: Wed, 20 Dec 2017 15:13:16 -0500 (EST)	[thread overview]
Message-ID: <20171220.151316.1006713323797534874.davem@davemloft.net> (raw)
In-Reply-To: <20171220173419.11259-1-idosch@mellanox.com>

From: Ido Schimmel <idosch@mellanox.com>
Date: Wed, 20 Dec 2017 19:34:19 +0200

> Since commit 0ddcf43d5d4a ("ipv4: FIB Local/MAIN table collapse") the
> local table uses the same trie allocated for the main table when custom
> rules are not in use.
> 
> When a net namespace is dismantled, the main table is flushed and freed
> (via an RCU callback) before the local table. In case the callback is
> invoked before the local table is iterated, a use-after-free can occur.
> 
> Fix this by iterating over the FIB tables in reverse order, so that the
> main table is always freed after the local table.
> 
> v3: Reworded comment according to Alex's suggestion.
> v2: Add a comment to make the fix more explicit per Dave's and Alex's
> feedback.
> 
> Fixes: 0ddcf43d5d4a ("ipv4: FIB Local/MAIN table collapse")
> Signed-off-by: Ido Schimmel <idosch@mellanox.com>
> Reported-by: Fengguang Wu <fengguang.wu@intel.com>

Applied and queued up for -stable.

      parent reply	other threads:[~2017-12-20 20:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-20 17:34 [PATCH net v3] ipv4: Fix use-after-free when flushing FIB tables Ido Schimmel
2017-12-20 17:46 ` Alexander Duyck
2017-12-20 20:13 ` David Miller [this message]

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=20171220.151316.1006713323797534874.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=alexander.h.duyck@intel.com \
    --cc=dsahern@gmail.com \
    --cc=fengguang.wu@intel.com \
    --cc=idosch@mellanox.com \
    --cc=mlxsw@mellanox.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox