lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190418140614.3973-2-jiri@resnulli.us>
Date:   Thu, 18 Apr 2019 16:06:00 +0200
From:   Jiri Pirko <jiri@...nulli.us>
To:     netdev@...r.kernel.org
Cc:     davem@...emloft.net, mlxsw@...lanox.com,
        jakub.kicinski@...ronome.com, dsahern@...il.com
Subject: [patch net-next 01/15] netdevsim: move device registration on bus to be done earlier in init

From: Jiri Pirko <jiri@...lanox.com>

As a dependency of the subsequent patch, mode device registration to be
done earlier, directly in nsim_newlink().

Signed-off-by: Jiri Pirko <jiri@...lanox.com>
---
 drivers/net/netdevsim/netdev.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c
index 7805fa840383..6ac5447bca02 100644
--- a/drivers/net/netdevsim/netdev.c
+++ b/drivers/net/netdevsim/netdev.c
@@ -174,25 +174,14 @@ static int nsim_init(struct net_device *dev)
 	if (err)
 		goto err_debugfs_destroy;
 
-	ns->dev.id = nsim_dev_id++;
-	ns->dev.bus = &nsim_bus;
-	ns->dev.type = &nsim_dev_type;
-	err = device_register(&ns->dev);
-	if (err)
-		goto err_bpf_uninit;
-
-	SET_NETDEV_DEV(dev, &ns->dev);
-
 	err = nsim_devlink_setup(ns);
 	if (err)
-		goto err_unreg_dev;
+		goto err_bpf_uninit;
 
 	nsim_ipsec_init(ns);
 
 	return 0;
 
-err_unreg_dev:
-	device_unregister(&ns->dev);
 err_bpf_uninit:
 	nsim_bpf_uninit(ns);
 err_debugfs_destroy:
@@ -514,11 +503,22 @@ static int nsim_newlink(struct net *src_net, struct net_device *dev,
 	if (IS_ERR(ns->sdev))
 		return PTR_ERR(ns->sdev);
 
-	err = register_netdevice(dev);
+	ns->dev.id = nsim_dev_id++;
+	ns->dev.bus = &nsim_bus;
+	ns->dev.type = &nsim_dev_type;
+	err = device_register(&ns->dev);
 	if (err)
 		goto err_sdev_put;
+
+	SET_NETDEV_DEV(dev, &ns->dev);
+
+	err = register_netdevice(dev);
+	if (err)
+		goto err_unreg_dev;
 	return 0;
 
+err_unreg_dev:
+	device_unregister(&ns->dev);
 err_sdev_put:
 	nsim_sdev_put(ns->sdev);
 	return err;
-- 
2.17.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ