Thread (1 message) 1 message, 1 author, 2021-11-08
STALE1749d

[PATCH v0 22/42] net: fib_notifier: Check notifier registration return value

From: Borislav Petkov <bp@alien8.de>
Date: 2021-11-08 10:14:40
Also in: lkml
Subsystem: networking [general], networking [ipv4/ipv6], the rest · Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, David Ahern, Ido Schimmel, Linus Torvalds

From: Borislav Petkov <redacted>

Avoid homegrown notifier registration checks.

No functional changes.

Signed-off-by: Borislav Petkov <redacted>
Cc: netdev@vger.kernel.org
---
 net/core/fib_notifier.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/core/fib_notifier.c b/net/core/fib_notifier.c
index fc96259807b6..fa07d6a81ba0 100644
--- a/net/core/fib_notifier.c
+++ b/net/core/fib_notifier.c
@@ -86,7 +86,9 @@ static bool fib_dump_is_consistent(struct net *net, struct notifier_block *nb,
 {
 	struct fib_notifier_net *fn_net = net_generic(net, fib_notifier_net_id);
 
-	atomic_notifier_chain_register(&fn_net->fib_chain, nb);
+	if (atomic_notifier_chain_register(&fn_net->fib_chain, nb))
+		pr_warn("FIB notifier already registered\n");
+
 	if (fib_seq == fib_seq_sum(net))
 		return true;
 	atomic_notifier_chain_unregister(&fn_net->fib_chain, nb);
-- 
2.29.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help