[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1500543694-23465-1-git-send-email-xiangxia.m.yue@gmail.com>
Date: Thu, 20 Jul 2017 02:41:34 -0700
From: Tonghao Zhang <xiangxia.m.yue@...il.com>
To: netdev@...r.kernel.org
Cc: Tonghao Zhang <xiangxia.m.yue@...il.com>
Subject: [PATCH] tun/tap: Add the missed return value check of register_netdevice_notifier
There is some codes of tun/tap module which did not check the return
value of register_netdevice_notifier. Add the check now.
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@...il.com>
---
drivers/net/tun.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 3d4c245..32ad873 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -2598,8 +2598,16 @@ static int __init tun_init(void)
goto err_misc;
}
- register_netdevice_notifier(&tun_notifier_block);
+ ret = register_netdevice_notifier(&tun_notifier_block);
+ if (ret) {
+ pr_err("Can't register netdevice notifier\n");
+ goto err_notifier;
+ }
+
return 0;
+
+err_notifier:
+ misc_deregister(&tun_miscdev);
err_misc:
rtnl_link_unregister(&tun_link_ops);
err_linkops:
--
1.8.3.1
Powered by blists - more mailing lists