linux-stable/net
Alexei Starovoitov dcdfdf56b4 ipv4: fix race in concurrent ip_route_input_slow()
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>
2013-11-20 15:28:44 -05:00
..
9p Nothing really exciting: some groundwork for changing virtio endian, and 2013-11-15 13:28:47 +09:00
802
8021q Merge branch 'core-locking-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2013-11-14 16:30:30 +09:00
appletalk
atm
ax25 ax25: cleanup a range test 2013-10-18 13:56:07 -04:00
batman-adv batman-adv: generalize batman-adv icmp packet handling 2013-10-23 17:03:47 +02:00
bluetooth Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem 2013-11-08 09:03:10 -05:00
bridge Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2013-11-19 15:50:47 -08:00
caif caif: use pskb_put() instead of reimplementing its functionality 2013-11-07 19:28:59 -05:00
can Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial 2013-11-15 16:47:22 -08:00
ceph net: 8021q/bluetooth/bridge/can/ceph: Remove extern from function prototypes 2013-10-19 19:12:11 -04:00
core genetlink: make multicast groups const, prevent abuse 2013-11-19 16:39:06 -05:00
dcb
dccp ipv4: introduce new IP_MTU_DISCOVER mode IP_PMTUDISC_INTERFACE 2013-11-05 21:52:27 -05:00
decnet
dns_resolver
dsa
ethernet
hsr genetlink: make multicast groups const, prevent abuse 2013-11-19 16:39:06 -05:00
ieee802154 genetlink: make multicast groups const, prevent abuse 2013-11-19 16:39:06 -05:00
ipv4 ipv4: fix race in concurrent ip_route_input_slow() 2013-11-20 15:28:44 -05:00
ipv6 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2013-11-19 15:50:47 -08:00
ipx
irda genetlink: only pass array to genl_register_family_with_ops() 2013-11-19 16:39:05 -05:00
iucv
key
l2tp genetlink: only pass array to genl_register_family_with_ops() 2013-11-19 16:39:05 -05:00
lapb
llc
mac80211 Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem 2013-11-08 09:03:10 -05:00
mac802154 6lowpan: set and use mac_len for mac header length 2013-10-30 17:18:46 -04:00
mpls ipip: add GSO/TSO support 2013-10-19 19:36:19 -04:00
netfilter Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2013-11-19 15:50:47 -08:00
netlabel genetlink: only pass array to genl_register_family_with_ops() 2013-11-19 16:39:05 -05:00
netlink genetlink: make multicast groups const, prevent abuse 2013-11-19 16:39:06 -05:00
netrom
nfc genetlink: make multicast groups const, prevent abuse 2013-11-19 16:39:06 -05:00
openvswitch Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2013-11-19 15:50:47 -08:00
packet
phonet Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2013-11-19 15:50:47 -08:00
rds inet: convert inet_ehash_secret and ipv6_hash_secret to net_get_random_once 2013-10-19 19:45:35 -04:00
rfkill net: rfkill: gpio: add ACPI support 2013-10-28 15:05:25 +01:00
rose
rxrpc net: misc: Remove extern from function prototypes 2013-10-19 19:12:11 -04:00
sched pkt_sched: fq: fix pacing for small frames 2013-11-15 21:01:52 -05:00
sctp Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2013-11-19 15:50:47 -08:00
sunrpc NFS client bugfixes: 2013-11-16 13:14:56 -08:00
tipc genetlink: only pass array to genl_register_family_with_ops() 2013-11-19 16:39:05 -05:00
unix net: unix: inherit SOCK_PASS{CRED, SEC} flags from socket to fix race 2013-10-19 18:50:15 -04:00
vmw_vsock
wimax genetlink: make multicast groups const, prevent abuse 2013-11-19 16:39:06 -05:00
wireless genetlink: make multicast groups const, prevent abuse 2013-11-19 16:39:06 -05:00
x25 net: x25: Fix dead URLs in Kconfig 2013-10-29 17:35:17 -04:00
xfrm net: move pskb_put() to core code 2013-11-07 19:28:58 -05:00
compat.c
Kconfig net/hsr: Add support for the High-availability Seamless Redundancy protocol (HSRv0) 2013-11-03 23:20:14 -05:00
Makefile net/hsr: Add support for the High-availability Seamless Redundancy protocol (HSRv0) 2013-11-03 23:20:14 -05:00
nonet.c
socket.c
sysctl_net.c