diff options
author | David S. Miller <davem@davemloft.net> | 2017-05-26 20:46:35 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-05-26 20:46:35 -0400 |
commit | 34aa83c2fc23e055968387c8b78ac8bafd735aff (patch) | |
tree | a53a341d74613e512bf467ea12615f509cb53536 /net/ipv4/route.c | |
parent | 47936d35edbac5e58064bd15e51136050b2f2717 (diff) | |
parent | e2a9aa5ab2a4d1fb05fcdfa9661d54e437093297 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Overlapping changes in drivers/net/phy/marvell.c, bug fix in 'net'
restricting a HW workaround alongside cleanups in 'net-next'.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/route.c')
-rw-r--r-- | net/ipv4/route.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 3a7425694d8b..f1f2e5aaa2d6 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -1387,8 +1387,12 @@ static void rt_add_uncached_list(struct rtable *rt) static void ipv4_dst_destroy(struct dst_entry *dst) { + struct dst_metrics *p = (struct dst_metrics *)DST_METRICS_PTR(dst); struct rtable *rt = (struct rtable *) dst; + if (p != &dst_default_metrics && atomic_dec_and_test(&p->refcnt)) + kfree(p); + if (!list_empty(&rt->rt_uncached)) { struct uncached_list *ul = rt->rt_uncached_list; @@ -1440,7 +1444,11 @@ static void rt_set_nexthop(struct rtable *rt, __be32 daddr, rt->rt_gateway = nh->nh_gw; rt->rt_uses_gateway = 1; } - dst_init_metrics(&rt->dst, fi->fib_metrics, true); + dst_init_metrics(&rt->dst, fi->fib_metrics->metrics, true); + if (fi->fib_metrics != &dst_default_metrics) { + rt->dst._metrics |= DST_METRICS_REFCOUNTED; + atomic_inc(&fi->fib_metrics->refcnt); + } #ifdef CONFIG_IP_ROUTE_CLASSID rt->dst.tclassid = nh->nh_tclassid; #endif |