Ido Schimmel
b4681c2829
ipv4: Fix use-after-free when flushing FIB tables
...
Since commit 0ddcf43d5d ("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: 0ddcf43d5d ("ipv4: FIB Local/MAIN table collapse")
Signed-off-by: Ido Schimmel <[email protected] >
Reported-by: Fengguang Wu <[email protected] >
Acked-by: Alexander Duyck <[email protected] >
Signed-off-by: David S. Miller <[email protected] >
2017-12-20 15:12:39 -05:00
..
netfilter
netfilter: ipt_CLUSTERIP: fix clusterip_net_exit build regression
2017-12-07 23:19:58 +01:00
af_inet.c
net: accept UFO datagrams from tuntap and packet
2017-11-24 01:37:35 +09:00
ah4.c
net: use -ENOSPC for transient busy indication
2017-11-03 22:11:17 +08:00
arp.c
ipv4: mark expected switch fall-throughs
2017-10-18 14:10:29 +01:00
cipso_ipv4.c
tcp/dccp: fix ireq->opt races
2017-10-21 01:33:19 +01:00
datagram.c
devinet.c
ipv4: igmp: guard against silly MTU values
2017-12-13 13:13:58 -05:00
esp4.c
net: use -ENOSPC for transient busy indication
2017-11-03 22:11:17 +08:00
esp4_offload.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
2017-09-01 17:42:05 -07:00
fib_frontend.c
ipv4: Fix use-after-free when flushing FIB tables
2017-12-20 15:12:39 -05:00
fib_lookup.h
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
fib_notifier.c
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
fib_rules.c
fib_semantics.c
ipv4: fib: Fix metrics match when deleting a route
2017-12-19 14:21:58 -05:00
fib_trie.c
net: Add extack to fib_notifier_info
2017-11-01 11:50:43 +09:00
fou.c
gre_demux.c
gre_offload.c
gso: fix payload length when gso_size is zero
2017-10-08 10:12:15 -07:00
icmp.c
ipv4: icmp: use BUG_ON instead of if condition followed by BUG
2017-10-24 18:44:42 +09:00
igmp.c
net: igmp: Use correct source address on IGMPv3 reports
2017-12-13 13:51:27 -05:00
inet_connection_sock.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
2017-10-30 21:09:24 +09:00
inet_diag.c
inet_diag: allow protocols to provide additional data
2017-09-01 18:38:09 -07:00
inet_fragment.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
2017-11-15 11:56:19 -08:00
inet_hashtables.c
soreuseport: fix initialization race
2017-10-22 02:03:51 +01:00
inet_timewait_sock.c
Revert "tcp: must block bh in __inet_twsk_hashdance()"
2017-12-05 11:23:58 -05:00
inetpeer.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
2017-10-05 18:19:22 -07:00
ip_forward.c
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
ip_fragment.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
2017-11-04 09:26:51 +09:00
ip_gre.c
ip_gre: remove the incorrect mtu limit for ipgre tap
2017-12-19 13:45:32 -05:00
ip_input.c
IPv4: early demux can return an error code
2017-10-01 03:55:47 +01:00
ip_options.c
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
ip_output.c
ip_sockglue.c
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
ip_tunnel.c
ipv4: igmp: guard against silly MTU values
2017-12-13 13:13:58 -05:00
ip_tunnel_core.c
ip_vti.c
ip_vti: remove the useless err_count check in vti_xmit
2017-11-01 11:57:32 +09:00
ipcomp.c
ipconfig.c
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
ipip.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
2017-10-30 21:09:24 +09:00
ipmr.c
treewide: setup_timer() -> timer_setup()
2017-11-21 15:57:07 -08:00
Kconfig
ip: update policy routing config help
2017-10-12 22:57:11 -07:00
Makefile
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
netfilter.c
ping.c
proc.c
tcp: retire FACK loss detection
2017-11-11 18:53:16 +09:00
protocol.c
raw.c
net: ipv4: fix for a race condition in raw_sendmsg
2017-12-11 14:05:31 -05:00
raw_diag.c
route.c
route: also update fnhe_genid when updating a route cache
2017-11-18 10:32:41 +09:00
syncookies.c
tcp: Namespace-ify sysctl_tcp_workaround_signed_windows
2017-10-28 19:24:38 +09:00
sysctl_net_ipv4.c
tcp: Namespace-ify sysctl_tcp_default_congestion_control
2017-11-15 14:09:52 +09:00
tcp.c
tcp: invalidate rate samples during SACK reneging
2017-12-08 10:07:02 -05:00
tcp_bbr.c
tcp_bbr: reset long-term bandwidth sampling on loss recovery undo
2017-12-08 13:27:43 -05:00
tcp_bic.c
tcp_cdg.c
tcp: cdg: make struct tcp_cdg static
2017-10-16 21:24:25 +01:00
tcp_cong.c
tcp: Namespace-ify sysctl_tcp_default_congestion_control
2017-11-15 14:09:52 +09:00
tcp_cubic.c
tcp_dctcp.c
tcp_diag.c
tcp_diag: report TCP MD5 signing keys and addresses
2017-09-01 18:38:09 -07:00
tcp_fastopen.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
2017-11-04 09:26:51 +09:00
tcp_highspeed.c
tcp_htcp.c
tcp_hybla.c
tcp_illinois.c
tcp_input.c
tcp: fix potential underestimation on rcv_rtt
2017-12-13 16:01:17 -05:00
tcp_ipv4.c
tcp md5sig: Use skb's saddr when replying to an incoming segment
2017-12-12 11:15:42 -05:00
tcp_lp.c
tcp_metrics.c
tcp: retire FACK loss detection
2017-11-11 18:53:16 +09:00
tcp_minisocks.c
tcp/dccp: block bh before arming time_wait timer
2017-12-01 15:07:43 -05:00
tcp_nv.c
tcp_nv: use do_div() instead of expensive div64_u64()
2017-11-04 22:34:52 +09:00
tcp_offload.c
tcp: gso: avoid refcount_t warning from tcp_gso_segment()
2017-11-10 18:07:15 +09:00
tcp_output.c
tcp: when scheduling TLP, time of RTO should account for current ACK
2017-11-19 12:25:26 +09:00
tcp_probe.c
tcp_rate.c
tcp: invalidate rate samples during SACK reneging
2017-12-08 10:07:02 -05:00
tcp_recovery.c
tcp: evaluate packet losses upon RTT change
2017-12-08 14:14:11 -05:00
tcp_scalable.c
tcp_timer.c
tcp: refresh tcp_mstamp from timers callbacks
2017-12-13 16:04:04 -05:00
tcp_ulp.c
tcp_vegas.c
tcp: fix under-evaluated ssthresh in TCP Vegas
2017-09-29 06:07:00 +01:00
tcp_vegas.h
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
tcp_veno.c
tcp_westwood.c
tcp: Revert "tcp: remove CA_ACK_SLOWPATH"
2017-08-30 11:20:08 -07:00
tcp_yeah.c
tunnel4.c
udp.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
2017-11-15 11:56:19 -08:00
udp_diag.c
udp_impl.h
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
udp_offload.c
net: accept UFO datagrams from tuntap and packet
2017-11-24 01:37:35 +09:00
udp_tunnel.c
udplite.c
xfrm4_input.c
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
xfrm4_mode_beet.c
xfrm4_mode_transport.c
xfrm4_mode_tunnel.c
xfrm4_output.c
xfrm4_policy.c
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
xfrm4_protocol.c
xfrm4_state.c
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
2017-11-02 11:10:55 +01:00
xfrm4_tunnel.c