aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/net_namespace.c
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2011-06-14 02:15:49 -0400
committerPaul Mundt <lethal@linux-sh.org>2011-06-14 02:15:49 -0400
commit9aa7719e0c6a1580451900e672744752804f8f75 (patch)
treeba36c5536342db2759d0a1843dffd0c193e26ff0 /net/core/net_namespace.c
parent583af252ab07cd1e8721878463da5b7016c18fdc (diff)
parent2c53b436a30867eb6b47dd7bab23ba638d1fb0d2 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 into sh-fixes-for-linus
Diffstat (limited to 'net/core/net_namespace.c')
-rw-r--r--net/core/net_namespace.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index 6c6b86d0da1..e41e5110c65 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -310,19 +310,17 @@ struct net *get_net_ns_by_fd(int fd)
310 struct file *file; 310 struct file *file;
311 struct net *net; 311 struct net *net;
312 312
313 net = ERR_PTR(-EINVAL);
314 file = proc_ns_fget(fd); 313 file = proc_ns_fget(fd);
315 if (!file) 314 if (IS_ERR(file))
316 goto out; 315 return ERR_CAST(file);
317 316
318 ei = PROC_I(file->f_dentry->d_inode); 317 ei = PROC_I(file->f_dentry->d_inode);
319 if (ei->ns_ops != &netns_operations) 318 if (ei->ns_ops == &netns_operations)
320 goto out; 319 net = get_net(ei->ns);
320 else
321 net = ERR_PTR(-EINVAL);
321 322
322 net = get_net(ei->ns); 323 fput(file);
323out:
324 if (file)
325 fput(file);
326 return net; 324 return net;
327} 325}
328 326