aboutsummaryrefslogtreecommitdiffstats
path: root/net
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
parent6344c433a452b1a05d03a61a6a85d89f793bb7b8 (diff)
copy address of proc_ns_ops into ns_common
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'net')
-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)
339{ 339{
340 struct proc_ns *ei; 340 struct proc_ns *ei;
341 struct file *file; 341 struct file *file;
342 struct ns_common *ns;
342 struct net *net; 343 struct net *net;
343 344
344 file = proc_ns_fget(fd); 345 file = proc_ns_fget(fd);
@@ -346,8 +347,9 @@ struct net *get_net_ns_by_fd(int fd)
346 return ERR_CAST(file); 347 return ERR_CAST(file);
347 348
348 ei = get_proc_ns(file_inode(file)); 349 ei = get_proc_ns(file_inode(file));
349 if (ei->ns_ops == &netns_operations) 350 ns = ei->ns;
350 net = get_net(container_of(ei->ns, struct net, ns)); 351 if (ns->ops == &netns_operations)
352 net = get_net(container_of(ns, struct net, ns));
351 else 353 else
352 net = ERR_PTR(-EINVAL); 354 net = ERR_PTR(-EINVAL);
353 355
@@ -386,6 +388,9 @@ EXPORT_SYMBOL_GPL(get_net_ns_by_pid);
386 388
387static __net_init int net_ns_net_init(struct net *net) 389static __net_init int net_ns_net_init(struct net *net)
388{ 390{
391#ifdef CONFIG_NET_NS
392 net->ns.ops = &netns_operations;
393#endif
389 return ns_alloc_inum(&net->ns); 394 return ns_alloc_inum(&net->ns);
390} 395}
391 396