summaryrefslogtreecommitdiffstats
path: root/net/core/net_namespace.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2014-11-01 02:32:53 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2014-12-04 14:34:47 -0500
commit33c429405a2c8d9e42afb9fee88a63cfb2de1e98 (patch)
treed2ffe096cd36852049b844c8befd1ba0ba6cf18c /net/core/net_namespace.c
parent6344c433a452b1a05d03a61a6a85d89f793bb7b8 (diff)
downloadlinux-33c429405a2c8d9e42afb9fee88a63cfb2de1e98.tar.gz
linux-33c429405a2c8d9e42afb9fee88a63cfb2de1e98.tar.bz2
linux-33c429405a2c8d9e42afb9fee88a63cfb2de1e98.zip
copy address of proc_ns_ops into ns_common
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'net/core/net_namespace.c')
-rw-r--r--net/core/net_namespace.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index da775f53f3fd..4d4acaf7b498 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -339,6 +339,7 @@ struct net *get_net_ns_by_fd(int fd)
{
struct proc_ns *ei;
struct file *file;
+ struct ns_common *ns;
struct net *net;
file = proc_ns_fget(fd);
@@ -346,8 +347,9 @@ struct net *get_net_ns_by_fd(int fd)
return ERR_CAST(file);
ei = get_proc_ns(file_inode(file));
- if (ei->ns_ops == &netns_operations)
- net = get_net(container_of(ei->ns, struct net, ns));
+ ns = ei->ns;
+ if (ns->ops == &netns_operations)
+ net = get_net(container_of(ns, struct net, ns));
else
net = ERR_PTR(-EINVAL);
@@ -386,6 +388,9 @@ EXPORT_SYMBOL_GPL(get_net_ns_by_pid);
static __net_init int net_ns_net_init(struct net *net)
{
+#ifdef CONFIG_NET_NS
+ net->ns.ops = &netns_operations;
+#endif
return ns_alloc_inum(&net->ns);
}