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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 16 Jun 2017 15:10:03 +0300
From:   Serhey Popovych <serhe.popovych@...il.com>
To:     netdev@...r.kernel.org
Subject: [PATCH] loopback: Force LOOPBACK_IFINDEX for registration

Now with commit 9c7dafb (net: Allow to create links with
given ifindex) support registration of network devices
with specific ifindex is added.

We can force loopback network device index before call to
register_netdev() to ensure we always configure it with
LOOPBACK_IFINDEX.

Kill BUG_ON() since system can continue without network
namespace failed in loopback init path, unless it is
init_net namespace where we panic() anyway.

Signed-off-by: Serhey Popovych <serhe.popovych@...il.com>
---
 drivers/net/loopback.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c
index 3061249..d7233aa 100644
--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -210,12 +210,13 @@ static __net_init int loopback_net_init(struct net *net)
 	if (!dev)
 		goto out;
 
+	dev->ifindex = LOOPBACK_IFINDEX;
+
 	dev_net_set(dev, net);
 	err = register_netdev(dev);
 	if (err)
 		goto out_free_netdev;
 
-	BUG_ON(dev->ifindex != LOOPBACK_IFINDEX);
 	net->loopback_dev = dev;
 	return 0;
 
-- 
1.8.3.1

Powered by blists - more mailing lists