Skip to contentSkip to conversation

Don't panic on creating the namespace's loopback

PATCH In review Pavel Emelyanov 2 participants 2 messages Oct 15, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Don't panic on creating the namespace's loopback

When the loopback device is failed to initialize inside the new namespaces, panic() is called. Do not do it when the namespace in question is not the init_net.

Plus cleanup the error path a bit.

---

 drivers/net/loopback.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)
drivers/net/loopback.c +5 -6
index be25aa3..662b8d1 100644
@@ -265,17 +265,16 @@ static __net_init int loopback_net_init(struct net *net)
 	if (err)
 		goto out_free_netdev;
 
-	err = 0;
 	net->loopback_dev = dev;
+	return 0;
 
-out:
-	if (err)
-		panic("loopback: Failed to register netdevice: %d\n", err);
-	return err;
 
 out_free_netdev:
 	free_netdev(dev);
-	goto out;
+out:
+	if (net == &init_net)
+		panic("loopback: Failed to register netdevice: %d\n", err);
+	return err;
 }
 
 static __net_exit void loopback_net_exit(struct net *net)
maintainer
#1 lore raw

From: Pavel Emelyanov <[email protected]>
Date: Mon, 15 Oct 2007 14:23:13 +0400

Quoted 7 lines

When the loopback device is failed to initialize inside the new namespaces, panic() is called. Do not do it when the namespace in question is not the init_net.

Plus cleanup the error path a bit.

Fair enough, applied.