[PATCH] batman-adv/main: Fix check on return value of rtnl_link_register
From: Aditya Pakki
Date: Mon Dec 24 2018 - 12:49:46 EST
rtnl_link_register() may fail and can impact registering the device.
The fix checks the return value and pushes the error upstream.
Signed-off-by: Aditya Pakki <pakki001@xxxxxxx>
---
net/batman-adv/main.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c
index 69c0d85bceb3..e0007f242823 100644
--- a/net/batman-adv/main.c
+++ b/net/batman-adv/main.c
@@ -109,7 +109,10 @@ static int __init batadv_init(void)
batadv_debugfs_init();
register_netdevice_notifier(&batadv_hard_if_notifier);
- rtnl_link_register(&batadv_link_ops);
+ ret = rtnl_link_register(&batadv_link_ops);
+ if (ret < 0)
+ return ret;
+
batadv_netlink_register();
pr_info("B.A.T.M.A.N. advanced %s (compatibility version %i) loaded\n",
--
2.17.1