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: <174265442494.356712.9873938655056545587.stgit@pro.pro>
Date: Sat, 22 Mar 2025 17:40:24 +0300
From: Kirill Tkhai <tkhai@...ru>
To: netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org
Cc: tkhai@...ru
Subject: [PATCH NET-PREV 20/51] ppp: Use __register_netdevice in .newlink

The objective is to conform .newlink with its callers,
which already assign nd_lock (and matches master nd_lock
if there is one).

Signed-off-by: Kirill Tkhai <tkhai@...ru>
---
 drivers/net/ppp/ppp_generic.c |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ppp/ppp_generic.c b/drivers/net/ppp/ppp_generic.c
index eb9acfcaeb09..c094bc5e6d8f 100644
--- a/drivers/net/ppp/ppp_generic.c
+++ b/drivers/net/ppp/ppp_generic.c
@@ -1216,7 +1216,7 @@ static int ppp_unit_register(struct ppp *ppp, int unit, bool ifname_is_set)
 
 	mutex_unlock(&pn->all_ppp_mutex);
 
-	ret = register_netdevice(ppp->dev);
+	ret = __register_netdevice(ppp->dev);
 	if (ret < 0)
 		goto err_unit;
 
@@ -3331,6 +3331,7 @@ static int ppp_create_interface(struct net *net, struct file *file, int *unit)
 		.unit = *unit,
 		.ifname_is_set = false,
 	};
+	struct nd_lock *nd_lock;
 	struct net_device *dev;
 	struct ppp *ppp;
 	int err;
@@ -3343,7 +3344,13 @@ static int ppp_create_interface(struct net *net, struct file *file, int *unit)
 	dev_net_set(dev, net);
 	dev->rtnl_link_ops = &ppp_link_ops;
 
+	if (!attach_new_nd_lock(dev)) {
+		err = -ENOMEM;
+		goto err_free;
+	}
+
 	rtnl_lock();
+	lock_netdev(dev, &nd_lock);
 
 	err = ppp_dev_configure(net, dev, &conf);
 	if (err < 0)
@@ -3351,12 +3358,16 @@ static int ppp_create_interface(struct net *net, struct file *file, int *unit)
 	ppp = netdev_priv(dev);
 	*unit = ppp->file.index;
 
+	unlock_netdev(nd_lock);
 	rtnl_unlock();
 
 	return 0;
 
 err_dev:
+	detach_nd_lock(dev);
+	unlock_netdev(nd_lock);
 	rtnl_unlock();
+err_free:
 	free_netdev(dev);
 err:
 	return err;


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ