[lvc-project] [PATCH] batman-adv: Check return value

Artem Chernyshev artem.chernyshev at red-soft.ru
Sun Dec 25 02:33:11 MSK 2022


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 at red-soft.ru>
---
 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




More information about the lvc-project mailing list