diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index 53b3e9c2da4cb017ccbcfd785b98ef60853a0ef2..f163fa0a1164692cd8afe6aa71aa17ab31be64dc 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c @@ -152,6 +152,7 @@ static void rt_fibinfo_free(struct rtable __rcu **rtp) * free_fib_info_rcu() */ + dst_dev_put(&rt->dst); dst_release(&rt->dst); dst_free(&rt->dst); } @@ -196,6 +197,7 @@ static void rt_fibinfo_free_cpus(struct rtable __rcu * __percpu *rtp) rt = rcu_dereference_protected(*per_cpu_ptr(rtp, cpu), 1); if (rt) { + dst_dev_put(&rt->dst); dst_release(&rt->dst); dst_free(&rt->dst); } diff --git a/net/ipv4/route.c b/net/ipv4/route.c index 3dee0043117effcde5a47139ff03920da4fbe9db..d986d80258d29facae23839e702d6fa49983ca55 100644 --- a/net/ipv4/route.c +++ b/net/ipv4/route.c @@ -603,12 +603,14 @@ static void fnhe_flush_routes(struct fib_nh_exception *fnhe) rt = rcu_dereference(fnhe->fnhe_rth_input); if (rt) { RCU_INIT_POINTER(fnhe->fnhe_rth_input, NULL); + dst_dev_put(&rt->dst); dst_release(&rt->dst); rt_free(rt); } rt = rcu_dereference(fnhe->fnhe_rth_output); if (rt) { RCU_INIT_POINTER(fnhe->fnhe_rth_output, NULL); + dst_dev_put(&rt->dst); dst_release(&rt->dst); rt_free(rt); } @@ -1337,6 +1339,7 @@ static bool rt_bind_exception(struct rtable *rt, struct fib_nh_exception *fnhe, dst_hold(&rt->dst); rcu_assign_pointer(*porig, rt); if (orig) { + dst_dev_put(&orig->dst); dst_release(&orig->dst); rt_free(orig); } @@ -1369,6 +1372,7 @@ static bool rt_cache_route(struct fib_nh *nh, struct rtable *rt) prev = cmpxchg(p, orig, rt); if (prev == orig) { if (orig) { + dst_dev_put(&orig->dst); dst_release(&orig->dst); rt_free(orig); }