[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20171220.151316.1006713323797534874.davem@davemloft.net>
Date: Wed, 20 Dec 2017 15:13:16 -0500 (EST)
From: David Miller <davem@...emloft.net>
To: idosch@...lanox.com
Cc: netdev@...r.kernel.org, alexander.h.duyck@...el.com,
dsahern@...il.com, fengguang.wu@...el.com, mlxsw@...lanox.com
Subject: Re: [PATCH net v3] ipv4: Fix use-after-free when flushing FIB
tables
From: Ido Schimmel <idosch@...lanox.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@...lanox.com>
> Reported-by: Fengguang Wu <fengguang.wu@...el.com>
Applied and queued up for -stable.
Powered by blists - more mailing lists