linux/net/core
Eric Dumazet 3fb07daff8 ipv4: add reference counting to metrics
Andrey Konovalov reported crashes in ipv4_mtu()

I could reproduce the issue with KASAN kernels, between
10.246.7.151 and 10.246.7.152 :

1) 20 concurrent netperf -t TCP_RR -H 10.246.7.152 -l 1000 &

2) At the same time run following loop :
while :
do
 ip ro add 10.246.7.152 dev eth0 src 10.246.7.151 mtu 1500
 ip ro del 10.246.7.152 dev eth0 src 10.246.7.151 mtu 1500
done

Cong Wang attempted to add back rt->fi in commit
82486aa6f1 ("ipv4: restore rt->fi for reference counting")
but this proved to add some issues that were complex to solve.

Instead, I suggested to add a refcount to the metrics themselves,
being a standalone object (in particular, no reference to other objects)

I tried to make this patch as small as possible to ease its backport,
instead of being super clean. Note that we believe that only ipv4 dst
need to take care of the metric refcount. But if this is wrong,
this patch adds the basic infrastructure to extend this to other
families.

Many thanks to Julian Anastasov for reviewing this patch, and Cong Wang
for his efforts on this problem.

Fixes: 2860583fe8 ("ipv4: Kill rt->fi")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Andrey Konovalov <andreyknvl@google.com>
Reviewed-by: Julian Anastasov <ja@ssi.bg>
Acked-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-05-26 14:57:07 -04:00
..
Makefile gro_cells: move to net/core/gro_cells.c 2017-02-08 14:38:18 -05:00
datagram.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2017-05-02 16:40:27 -07:00
dev.c xdp: refine xdp api with regards to generic xdp 2017-05-11 21:30:57 -04:00
dev_addr_lists.c
dev_ioctl.c
devlink.c net/devlink: Add E-Switch encapsulation control 2017-04-22 20:26:37 +03:00
drop_monitor.c drop_monitor: use setup_timer 2017-03-12 23:47:16 -07:00
dst.c ipv4: add reference counting to metrics 2017-05-26 14:57:07 -04:00
dst_cache.c
ethtool.c net: Add ESP offload features 2017-04-14 10:05:36 +02:00
fib_rules.c fib_rules: fix error return code 2017-04-27 16:35:57 -04:00
filter.c bpf: add bpf_clone_redirect to bpf_helper_changes_pkt_data 2017-05-25 13:44:28 -04:00
flow.c flowcache: more "unsigned int" 2017-04-03 19:04:48 -07:00
flow_dissector.c flow_dissector: add mpls support (v2) 2017-04-24 14:30:46 -04:00
gen_estimator.c
gen_stats.c
gro_cells.c net: Generic XDP 2017-04-25 13:33:49 -04:00
hwbm.c
link_watch.c
lwt_bpf.c netlink: pass extended ACK struct to parsing functions 2017-04-13 13:58:22 -04:00
lwtunnel.c lwtunnel: fix error path in lwtunnel_fill_encap() 2017-04-30 22:41:29 -04:00
neighbour.c neighbour: update neigh timestamps iff update is effective 2017-05-17 11:41:38 -04:00
net-procfs.c
net-sysfs.c net: use net->count to check whether a netns is alive or not 2017-03-13 16:02:27 -07:00
net-sysfs.h
net-traces.c
net_namespace.c net: move somaxconn init from sysctl code 2017-05-25 13:12:17 -04:00
netclassid_cgroup.c cgroup, net_cls: iterate the fds of only the tasks which are being migrated 2017-03-22 10:32:46 -07:00
netevent.c
netpoll.c netpoll: Check for skb->queue_mapping 2017-04-21 15:45:19 -04:00
netprio_cgroup.c net: break include loop netdevice.h, dsa.h, devlink.h 2017-03-28 22:46:04 -07:00
pktgen.c
ptp_classifier.c
request_sock.c
rtnetlink.c net: rtnetlink: bail out from rtnl_fdb_dump() on parse error 2017-05-24 15:27:16 -04:00
scm.c sched/headers: Prepare for new header dependencies before moving code to <linux/sched/user.h> 2017-03-02 08:42:29 +01:00
secure_seq.c tcp: randomize timestamps on syncookies 2017-05-05 12:00:11 -04:00
skbuff.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2017-05-02 16:40:27 -07:00
sock.c net: fix compile error in skb_orphan_partial() 2017-05-17 15:10:13 -04:00
sock_diag.c netlink: extended ACK reporting 2017-04-13 13:58:20 -04:00
sock_reuseport.c soreuseport: use "unsigned int" in __reuseport_alloc() 2017-04-03 19:06:38 -07:00
stream.c sched/headers: Prepare for new header dependencies before moving code to <linux/sched/signal.h> 2017-03-02 08:42:29 +01:00
sysctl_net_core.c net: move somaxconn init from sysctl code 2017-05-25 13:12:17 -04:00
timestamping.c
tso.c
utils.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2017-05-02 16:40:27 -07:00