lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211129120935.461678-1-razor@blackwall.org>
Date:   Mon, 29 Nov 2021 14:09:35 +0200
From:   Nikolay Aleksandrov <razor@...ckwall.org>
To:     netdev@...r.kernel.org
Cc:     davem@...emloft.net, kuba@...nel.org, dsahern@...il.com,
        Nikolay Aleksandrov <nikolay@...dia.com>
Subject: [PATCH net-next] net: ipv6: use the new fib6_nh_release_dsts helper in fib6_nh_release

From: Nikolay Aleksandrov <nikolay@...dia.com>

We can remove a bit of code duplication by reusing the new
fib6_nh_release_dsts helper in fib6_nh_release. Their only difference is
that fib6_nh_release's version doesn't use atomic operation to swap the
pointers because it assumes the fib6_nh is no longer visible, while
fib6_nh_release_dsts can be used anywhere.

Suggested-by: David Ahern <dsahern@...il.com>
Signed-off-by: Nikolay Aleksandrov <nikolay@...dia.com>
---
 net/ipv6/route.c | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 62f1e16eea2b..b44438b9a030 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -3656,24 +3656,9 @@ void fib6_nh_release(struct fib6_nh *fib6_nh)
 
 	rcu_read_unlock();
 
-	if (fib6_nh->rt6i_pcpu) {
-		int cpu;
-
-		for_each_possible_cpu(cpu) {
-			struct rt6_info **ppcpu_rt;
-			struct rt6_info *pcpu_rt;
-
-			ppcpu_rt = per_cpu_ptr(fib6_nh->rt6i_pcpu, cpu);
-			pcpu_rt = *ppcpu_rt;
-			if (pcpu_rt) {
-				dst_dev_put(&pcpu_rt->dst);
-				dst_release(&pcpu_rt->dst);
-				*ppcpu_rt = NULL;
-			}
-		}
-
+	fib6_nh_release_dsts(fib6_nh);
+	if (fib6_nh->rt6i_pcpu)
 		free_percpu(fib6_nh->rt6i_pcpu);
-	}
 
 	fib_nh_common_release(&fib6_nh->nh_common);
 }
-- 
2.31.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ