From 11afae523193d74f8978887d81e7f92ab640d806 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 17 Dec 2024 10:12:53 +0000 Subject: [PATCH] Revert "ipv6: release nexthop on device removal" This reverts commit b2f26a27ea3f72f75d18330f76f5d1007c791848 which is commit eb02688c5c45c3e7af7e71f036a7144f5639cbfe upstream. It breaks the Android kernel abi and can be brought back in the future in an abi-safe way if it is really needed. Bug: 161946584 Change-Id: Ied6f94415d8fc58e59fa2bbc15871fb6848cab17 Signed-off-by: Greg Kroah-Hartman --- net/ipv6/route.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 7658d1b4b573..67ee7429a131 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -378,7 +378,6 @@ static void ip6_dst_ifdown(struct dst_entry *dst, struct net_device *dev, { struct rt6_info *rt = (struct rt6_info *)dst; struct inet6_dev *idev = rt->rt6i_idev; - struct fib6_info *from; if (idev && idev->dev != blackhole_netdev) { struct inet6_dev *blackhole_idev = in6_dev_get(blackhole_netdev); @@ -388,8 +387,6 @@ static void ip6_dst_ifdown(struct dst_entry *dst, struct net_device *dev, in6_dev_put(idev); } } - from = unrcu_pointer(xchg(&rt->from, NULL)); - fib6_info_release(from); } static bool __rt6_check_expired(const struct rt6_info *rt) @@ -1452,6 +1449,7 @@ static DEFINE_SPINLOCK(rt6_exception_lock); static void rt6_remove_exception(struct rt6_exception_bucket *bucket, struct rt6_exception *rt6_ex) { + struct fib6_info *from; struct net *net; if (!bucket || !rt6_ex) @@ -1463,6 +1461,8 @@ static void rt6_remove_exception(struct rt6_exception_bucket *bucket, /* purge completely the exception to allow releasing the held resources: * some [sk] cache may keep the dst around for unlimited time */ + from = unrcu_pointer(xchg(&rt6_ex->rt6i->from, NULL)); + fib6_info_release(from); dst_dev_put(&rt6_ex->rt6i->dst); hlist_del_rcu(&rt6_ex->hlist);