]> git.baikalelectronics.ru Git - kernel.git/commit
ipv4: add reference counting to metrics
authorEric Dumazet <edumazet@google.com>
Thu, 25 May 2017 21:27:35 +0000 (14:27 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 26 May 2017 18:57:07 +0000 (14:57 -0400)
commit23a5f140b78b74297e8767cf5a4d79872b1bafda
tree4817be57c8a72f13e107221b29ef347854538991
parentf6387f6429b6e6272a1d4604d439959c4bf258ac
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
587844883a43 ("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: 39d150b4043b ("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>
include/net/dst.h
include/net/ip_fib.h
net/core/dst.c
net/ipv4/fib_semantics.c
net/ipv4/route.c