namespaces.c (1bc82070fa2763bdca626fa8bde72b35f11e8960) | namespaces.c (769071ac9f20b6a447410c7eaa55d1a5233ef40c) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2#include <linux/proc_fs.h> 3#include <linux/nsproxy.h> 4#include <linux/ptrace.h> 5#include <linux/namei.h> 6#include <linux/file.h> 7#include <linux/utsname.h> 8#include <net/net_namespace.h> --- 19 unchanged lines hidden (view full) --- 28#endif 29#ifdef CONFIG_USER_NS 30 &userns_operations, 31#endif 32 &mntns_operations, 33#ifdef CONFIG_CGROUPS 34 &cgroupns_operations, 35#endif | 1// SPDX-License-Identifier: GPL-2.0 2#include <linux/proc_fs.h> 3#include <linux/nsproxy.h> 4#include <linux/ptrace.h> 5#include <linux/namei.h> 6#include <linux/file.h> 7#include <linux/utsname.h> 8#include <net/net_namespace.h> --- 19 unchanged lines hidden (view full) --- 28#endif 29#ifdef CONFIG_USER_NS 30 &userns_operations, 31#endif 32 &mntns_operations, 33#ifdef CONFIG_CGROUPS 34 &cgroupns_operations, 35#endif |
36#ifdef CONFIG_TIME_NS 37 &timens_operations, 38 &timens_for_children_operations, 39#endif |
|
36}; 37 38static const char *proc_ns_get_link(struct dentry *dentry, 39 struct inode *inode, 40 struct delayed_call *done) 41{ 42 const struct proc_ns_operations *ns_ops = PROC_I(inode)->ns_ops; 43 struct task_struct *task; 44 struct path ns_path; | 40}; 41 42static const char *proc_ns_get_link(struct dentry *dentry, 43 struct inode *inode, 44 struct delayed_call *done) 45{ 46 const struct proc_ns_operations *ns_ops = PROC_I(inode)->ns_ops; 47 struct task_struct *task; 48 struct path ns_path; |
45 int error = -EACCES; | 49 void *error = ERR_PTR(-EACCES); |
46 47 if (!dentry) 48 return ERR_PTR(-ECHILD); 49 50 task = get_proc_task(inode); 51 if (!task) | 50 51 if (!dentry) 52 return ERR_PTR(-ECHILD); 53 54 task = get_proc_task(inode); 55 if (!task) |
52 return ERR_PTR(-EACCES); | 56 return error; |
53 | 57 |
54 if (!ptrace_may_access(task, PTRACE_MODE_READ_FSCREDS)) 55 goto out; 56 57 error = ns_get_path(&ns_path, task, ns_ops); 58 if (error) 59 goto out; 60 61 error = nd_jump_link(&ns_path); 62out: | 58 if (ptrace_may_access(task, PTRACE_MODE_READ_FSCREDS)) { 59 error = ns_get_path(&ns_path, task, ns_ops); 60 if (!error) 61 nd_jump_link(&ns_path); 62 } |
63 put_task_struct(task); | 63 put_task_struct(task); |
64 return ERR_PTR(error); | 64 return error; |
65} 66 67static int proc_ns_readlink(struct dentry *dentry, char __user *buffer, int buflen) 68{ 69 struct inode *inode = d_inode(dentry); 70 const struct proc_ns_operations *ns_ops = PROC_I(inode)->ns_ops; 71 struct task_struct *task; 72 char name[50]; --- 107 unchanged lines hidden --- | 65} 66 67static int proc_ns_readlink(struct dentry *dentry, char __user *buffer, int buflen) 68{ 69 struct inode *inode = d_inode(dentry); 70 const struct proc_ns_operations *ns_ops = PROC_I(inode)->ns_ops; 71 struct task_struct *task; 72 char name[50]; --- 107 unchanged lines hidden --- |