netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tun/tap: Add the missed return value check of register_netdevice_notifier
@ 2017-07-20  9:41 Tonghao Zhang
  2017-07-24 20:45 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Tonghao Zhang @ 2017-07-20  9:41 UTC (permalink / raw)
  To: netdev; +Cc: Tonghao Zhang

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@gmail.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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] tun/tap: Add the missed return value check of register_netdevice_notifier
  2017-07-20  9:41 [PATCH] tun/tap: Add the missed return value check of register_netdevice_notifier Tonghao Zhang
@ 2017-07-24 20:45 ` David Miller
  2017-07-25  2:43   ` Tonghao Zhang
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2017-07-24 20:45 UTC (permalink / raw)
  To: xiangxia.m.yue; +Cc: netdev

From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Date: Thu, 20 Jul 2017 02:41:34 -0700

> 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@gmail.com>

Applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] tun/tap: Add the missed return value check of register_netdevice_notifier
  2017-07-24 20:45 ` David Miller
@ 2017-07-25  2:43   ` Tonghao Zhang
  2017-07-25  3:49     ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Tonghao Zhang @ 2017-07-25  2:43 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

One question, this type bugfix will be applied to net-next ?
> On Jul 25, 2017, at 4:45 AM, David Miller <davem@davemloft.net> wrote:
> 
>> 
>> 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@gmail.com>
> 
> Applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] tun/tap: Add the missed return value check of register_netdevice_notifier
  2017-07-25  2:43   ` Tonghao Zhang
@ 2017-07-25  3:49     ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2017-07-25  3:49 UTC (permalink / raw)
  To: xiangxia.m.yue; +Cc: netdev

From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Date: Tue, 25 Jul 2017 10:43:26 +0800

> One question, this type bugfix will be applied to net-next ?

'net' is periodically merged into 'net-next', so yes.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-07-25  3:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-20  9:41 [PATCH] tun/tap: Add the missed return value check of register_netdevice_notifier Tonghao Zhang
2017-07-24 20:45 ` David Miller
2017-07-25  2:43   ` Tonghao Zhang
2017-07-25  3:49     ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).