summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2017-05-08 22:35:32 -0400
committerDavid S. Miller <davem@davemloft.net>2017-05-08 22:35:32 -0400
commit32f1bc0f3d262125169f9212aac306c638e34b54 (patch)
tree24b4135b07b5520a5f1912f46cc72d0ec38fadaa
parent922c60e89d52730050c6ccca218bff40cc8bcd8e (diff)
Revert "ipv4: restore rt->fi for reference counting"
This reverts commit 82486aa6f1b9bc8145e6d0fa2bc0b44307f3b875. As implemented, this causes dangling netdevice refs. Reported-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/route.h1
-rw-r--r--net/ipv4/route.c18
2 files changed, 1 insertions, 18 deletions
diff --git a/include/net/route.h b/include/net/route.h
index 4335eb72a04c..2cc0e14c6359 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -69,7 +69,6 @@ struct rtable {
struct list_head rt_uncached;
struct uncached_list *rt_uncached_list;
- struct fib_info *fi; /* for refcnt to shared metrics */
};
static inline bool rt_is_input_route(const struct rtable *rt)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index f647310f8e4d..655d9eebe43e 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -1387,11 +1387,6 @@ static void ipv4_dst_destroy(struct dst_entry *dst)
{
struct rtable *rt = (struct rtable *) dst;
- if (rt->fi) {
- fib_info_put(rt->fi);
- rt->fi = NULL;
- }
-
if (!list_empty(&rt->rt_uncached)) {
struct uncached_list *ul = rt->rt_uncached_list;
@@ -1429,16 +1424,6 @@ static bool rt_cache_valid(const struct rtable *rt)
!rt_is_expired(rt);
}
-static void rt_init_metrics(struct rtable *rt, struct fib_info *fi)
-{
- if (fi->fib_metrics != (u32 *)dst_default_metrics) {
- fib_info_hold(fi);
- rt->fi = fi;
- }
-
- dst_init_metrics(&rt->dst, fi->fib_metrics, true);
-}
-
static void rt_set_nexthop(struct rtable *rt, __be32 daddr,
const struct fib_result *res,
struct fib_nh_exception *fnhe,
@@ -1453,7 +1438,7 @@ static void rt_set_nexthop(struct rtable *rt, __be32 daddr,
rt->rt_gateway = nh->nh_gw;
rt->rt_uses_gateway = 1;
}
- rt_init_metrics(rt, fi);
+ dst_init_metrics(&rt->dst, fi->fib_metrics, true);
#ifdef CONFIG_IP_ROUTE_CLASSID
rt->dst.tclassid = nh->nh_tclassid;
#endif
@@ -1505,7 +1490,6 @@ struct rtable *rt_dst_alloc(struct net_device *dev,
rt->rt_gateway = 0;
rt->rt_uses_gateway = 0;
rt->rt_table_id = 0;
- rt->fi = NULL;
INIT_LIST_HEAD(&rt->rt_uncached);
rt->dst.output = ip_output;