linux-uconsole/net/ipv4
Alexei Starovoitov 62713c4b6b ipv4: fix race in concurrent ip_route_input_slow()
[ Upstream commit dcdfdf56b4 ]

CPUs can ask for local route via ip_route_input_noref() concurrently.
if nh_rth_input is not cached yet, CPUs will proceed to allocate
equivalent DSTs on 'lo' and then will try to cache them in nh_rth_input
via rt_cache_route()
Most of the time they succeed, but on occasion the following two lines:
	orig = *p;
	prev = cmpxchg(p, orig, rt);
in rt_cache_route() do race and one of the cpus fails to complete cmpxchg.
But ip_route_input_slow() doesn't check the return code of rt_cache_route(),
so dst is leaking. dst_destroy() is never called and 'lo' device
refcnt doesn't go to zero, which can be seen in the logs as:
	unregister_netdevice: waiting for lo to become free. Usage count = 1
Adding mdelay() between above two lines makes it easily reproducible.
Fix it similar to nh_pcpu_rth_output case.

Fixes: d2d68ba9fe ("ipv4: Cache input routes in fib_info nexthops.")
Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-12-08 07:29:26 -08:00
..
netfilter netfilter: ipt_ULOG: fix incorrect setting of ulog timer 2013-06-24 17:10:44 +02:00
af_inet.c net: net_secret should not depend on TCP 2013-10-13 16:08:30 -07:00
ah4.c net: Add skb_unclone() helper function. 2013-02-15 15:10:37 -05:00
arp.c firewire net, ipv4 arp: Extend hardware address and remove driver-level packet inspection. 2013-03-26 12:32:13 -04:00
cipso_ipv4.c cipso: don't follow a NULL pointer when setsockopt() is called 2012-07-18 09:01:12 -07:00
datagram.c ipv4: fix possible seqlock deadlock 2013-12-08 07:29:25 -08:00
devinet.c net: rtm_to_ifaddr: free ifa if ifa_cacheinfo processing fails 2013-09-14 06:54:54 -07:00
esp4.c esp4: fix error return code in esp_output() 2013-04-15 14:05:34 -04:00
fib_frontend.c net-next: replace obsolete NLMSG_* with type safe nlmsg_* 2013-03-28 14:25:25 -04:00
fib_lookup.h
fib_rules.c sections: fix section conflicts in net 2012-10-06 03:04:45 +09:00
fib_semantics.c hlist: drop the node parameter from iterators 2013-02-27 19:10:24 -08:00
fib_trie.c fib_trie: remove potential out of bound access 2013-09-14 06:54:54 -07:00
gre.c gre: fix a possible skb leak 2013-06-25 16:07:44 -07:00
icmp.c net: Add MIB counters for checksum errors 2013-04-29 15:14:03 -04:00
igmp.c ipv4 igmp: use in_dev_put in timer handlers instead of __in_dev_put 2013-10-13 16:08:30 -07:00
inet_connection_sock.c tcp: Remove TCPCT 2013-03-17 14:35:13 -04:00
inet_diag.c netlink: rename ssk to sk in struct netlink_skb_params 2013-04-19 14:57:56 -04:00
inet_fragment.c net: frag, fix race conditions in LRU list maintenance 2013-05-06 11:06:51 -04:00
inet_hashtables.c net: do not call sock_put() on TIMEWAIT sockets 2013-11-04 04:31:00 -08:00
inet_lro.c ipv4: replace ip_fast_csum with csum_replace2 2013-03-15 09:12:25 -04:00
inet_timewait_sock.c hlist: drop the node parameter from iterators 2013-02-27 19:10:24 -08:00
inetpeer.c ip: generate unique IP identificator if local fragmentation is allowed 2013-10-13 16:08:30 -07:00
ip_forward.c ipv4: introduce rt_uses_gateway 2012-10-08 17:42:36 -04:00
ip_fragment.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2013-04-22 20:32:51 -04:00
ip_gre.c ip_gre: Fix WCCPv2 header parsing. 2013-11-20 12:27:46 -08:00
ip_input.c ipv4: set transport header earlier 2013-07-28 16:30:04 -07:00
ip_options.c net/ipv4: Ensure that location of timestamp option is stored 2013-03-12 05:35:39 -04:00
ip_output.c inet: fix possible memory corruption with UDP_CORK and UFO 2013-11-04 04:31:05 -08:00
ip_sockglue.c inet: fix addr_len/msg->msg_namelen assignment in recv_error and rxpmtu functions 2013-12-08 07:29:25 -08:00
ip_tunnel.c ip_gre: Fix WCCPv2 header parsing. 2013-11-20 12:27:46 -08:00
ip_vti.c xfrm: Release dst if this dst is improper for vti tunnel 2013-12-08 07:29:25 -08:00
ipcomp.c xfrm: allow to avoid copying DSCP during encapsulation 2013-03-06 07:02:45 +01:00
ipconfig.c ipconfig: add informative timeout messages while waiting for carrier 2013-04-02 14:35:33 -04:00
ipip.c ip_gre: Fix WCCPv2 header parsing. 2013-11-20 12:27:46 -08:00
ipmr.c ip: generate unique IP identificator if local fragmentation is allowed 2013-10-13 16:08:30 -07:00
Kconfig Tunneling: use IP Tunnel stats APIs. 2013-03-26 12:27:19 -04:00
Makefile GRE: Refactor GRE tunneling code. 2013-03-26 12:27:18 -04:00
netfilter.c netfilter: add my copyright statements 2013-04-18 20:27:55 +02:00
ping.c inet: fix addr_len/msg->msg_namelen assignment in recv_error and rxpmtu functions 2013-12-08 07:29:25 -08:00
proc.c net: Add MIB counters for checksum errors 2013-04-29 15:14:03 -04:00
protocol.c ipv4: Disallow non-namespace aware protocols to register. 2013-02-05 14:42:23 -05:00
raw.c inet: fix addr_len/msg->msg_namelen assignment in recv_error and rxpmtu functions 2013-12-08 07:29:25 -08:00
route.c ipv4: fix race in concurrent ip_route_input_slow() 2013-12-08 07:29:26 -08:00
syncookies.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2013-04-22 20:32:51 -04:00
sysctl_net_ipv4.c tcp: TSO packets automatic sizing 2013-11-04 04:30:59 -08:00
tcp.c tcp: tsq: restore minimal amount of queueing 2013-12-08 07:29:24 -08:00
tcp_bic.c tcp: fix undo after RTO for BIC 2012-01-20 14:17:26 -05:00
tcp_cong.c tcp: remove Appropriate Byte Count support 2013-02-05 14:51:16 -05:00
tcp_cubic.c tcp: cubic: fix bug in bictcp_acked() 2013-09-14 06:54:54 -07:00
tcp_diag.c inet_diag: Rename inet_diag_req into inet_diag_req_v2 2012-01-11 12:56:06 -08:00
tcp_fastopen.c tcp: TCP Fast Open Server - header & support functions 2012-08-31 20:02:18 -04:00
tcp_highspeed.c
tcp_htcp.c
tcp_hybla.c tcp: bool conversions 2012-05-17 14:59:59 -04:00
tcp_illinois.c net: fix divide by zero in tcp algorithm illinois 2012-11-01 11:55:59 -04:00
tcp_input.c tcp: fix incorrect ca_state in tail loss probe 2013-11-04 04:30:59 -08:00
tcp_ipv4.c ipv4: Fixed MD5 key lookups when adding/ removing MD5 to/ from TCP sockets. 2013-06-19 21:21:53 -07:00
tcp_lp.c
tcp_memcontrol.c net: tcp_memcontrol: minor: remove unused variable 2013-04-14 15:41:49 -04:00
tcp_metrics.c net-tcp: fix panic in tcp_fastopen_cache_set() 2013-12-08 07:29:24 -08:00
tcp_minisocks.c tcp: reset timer after any SYNACK retransmit 2013-04-29 15:14:03 -04:00
tcp_output.c tcp: don't update snd_nxt, when a socket is switched from repair mode 2013-12-08 07:29:26 -08:00
tcp_probe.c net: proc: change proc_net_remove to remove_proc_entry 2013-02-18 14:53:08 -05:00
tcp_scalable.c
tcp_timer.c tcp: refactor F-RTO 2013-03-21 11:47:50 -04:00
tcp_vegas.c
tcp_vegas.h
tcp_veno.c
tcp_westwood.c tcp: refactor F-RTO 2013-03-21 11:47:50 -04:00
tcp_yeah.c
tunnel4.c net: Convert printks to pr_<level> 2012-03-11 23:42:51 -07:00
udp.c inet: fix addr_len/msg->msg_namelen assignment in recv_error and rxpmtu functions 2013-12-08 07:29:25 -08:00
udp_diag.c netlink: rename ssk to sk in struct netlink_skb_params 2013-04-19 14:57:56 -04:00
udp_impl.h ipv4: fix checkpatch errors 2012-04-15 12:37:19 -04:00
udplite.c net: ipv4: Standardize prefixes for message logging 2012-03-12 17:05:21 -07:00
xfrm4_input.c net: Add skb_unclone() helper function. 2013-02-15 15:10:37 -05:00
xfrm4_mode_beet.c ipsec: be careful of non existing mac headers 2012-02-23 16:50:45 -05:00
xfrm4_mode_transport.c
xfrm4_mode_tunnel.c ip: generate unique IP identificator if local fragmentation is allowed 2013-10-13 16:08:30 -07:00
xfrm4_output.c xfrm4: Don't call icmp_send on local error 2011-07-01 17:33:19 -07:00
xfrm4_policy.c xfrm: make gc_thresh configurable in all namespaces 2013-02-06 11:36:29 +01:00
xfrm4_state.c net: Add export.h for EXPORT_SYMBOL/THIS_MODULE to non-modules 2011-10-31 19:30:30 -04:00
xfrm4_tunnel.c net: ipv4: Standardize prefixes for message logging 2012-03-12 17:05:21 -07:00