Skip to content

Commit

Permalink
[NETNS]: Don't panic on creating the namespace's loopback
Browse files Browse the repository at this point in the history
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 <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Pavel Emelyanov authored and David S. Miller committed Oct 15, 2007
1 parent 4ae2894 commit 9d6dda3
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions drivers/net/loopback.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9d6dda3

Please sign in to comment.