From: Pavel Emelyanov Date: Mon, 15 Oct 2007 19:55:33 +0000 (-0700) Subject: [NETNS]: Don't panic on creating the namespace's loopback X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9d6dda32c7570bbf189cf74fbc36338d0a94e999;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git [NETNS]: 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. Signed-off-by: Pavel Emelyanov Signed-off-by: David S. Miller --- diff --git a/drivers/net/loopback.c b/drivers/net/loopback.c index be25aa33971..662b8d16803 100644 --- a/drivers/net/loopback.c +++ b/drivers/net/loopback.c @@ -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)