[PATCH] batman-adv: Check return value
From: Artem Chernyshev
Date: Sat Dec 24 2022 - 18:40:08 EST
Check, if rtnl_link_register() call in batadv_init() was successful
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: a4ac28c0d06a ("batman-adv: Allow to use rntl_link for device creation/deletion")
Signed-off-by: Artem Chernyshev <artem.chernyshev@xxxxxxxxxxx>
---
net/batman-adv/main.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c
index e8a449915566..04cd9682bd29 100644
--- a/net/batman-adv/main.c
+++ b/net/batman-adv/main.c
@@ -113,7 +113,11 @@ static int __init batadv_init(void)
goto err_create_wq;
register_netdevice_notifier(&batadv_hard_if_notifier);
- rtnl_link_register(&batadv_link_ops);
+ ret = rtnl_link_register(&batadv_link_ops);
+ if (ret) {
+ pr_err("Can't register link_ops\n");
+ goto err_create_wq;
+ }
batadv_netlink_register();
pr_info("B.A.T.M.A.N. advanced %s (compatibility version %i) loaded\n",
--
2.30.3