summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorIdo Schimmel <idosch@mellanox.com>2017-12-20 19:34:19 +0200
committerDavid S. Miller <davem@davemloft.net>2017-12-20 15:12:39 -0500
commitb4681c2829e24943aadd1a7bb3a30d41d0a20050 (patch)
tree2d10e2f4421317dd06c77ffe24d0cfd12b0dec87 /include
parentad3cbf61332914711e5f506972b1dc9af8d62146 (diff)
downloadlinux-b4681c2829e24943aadd1a7bb3a30d41d0a20050.tar.bz2
ipv4: Fix use-after-free when flushing FIB tables
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> Acked-by: Alexander Duyck <alexander.h.duyck@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions