diff mbox series

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

Message ID 20211108101157.15189-23-bp@alien8.de (mailing list archive)
State Not Applicable
Delegated to: Netdev Maintainers
Headers show
Series None | expand

Commit Message

Borislav Petkov Nov. 8, 2021, 10:11 a.m. UTC
From: Borislav Petkov <bp@suse.de>

Avoid homegrown notifier registration checks.

No functional changes.

Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: netdev@vger.kernel.org
---
 net/core/fib_notifier.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

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);