namespaces.c (3eb66e91a25497065c5322b1268cbc3953642227) | namespaces.c (ce623f89872df4253719be71531116751eeab85f) |
---|---|
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> --- 28 unchanged lines hidden (view full) --- 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; | 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> --- 28 unchanged lines hidden (view full) --- 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; |
45 void *error = ERR_PTR(-EACCES); | 45 int error = -EACCES; |
46 47 if (!dentry) 48 return ERR_PTR(-ECHILD); 49 50 task = get_proc_task(inode); 51 if (!task) | 46 47 if (!dentry) 48 return ERR_PTR(-ECHILD); 49 50 task = get_proc_task(inode); 51 if (!task) |
52 return error; | 52 return ERR_PTR(-EACCES); |
53 54 if (ptrace_may_access(task, PTRACE_MODE_READ_FSCREDS)) { 55 error = ns_get_path(&ns_path, task, ns_ops); 56 if (!error) 57 nd_jump_link(&ns_path); 58 } 59 put_task_struct(task); | 53 54 if (ptrace_may_access(task, PTRACE_MODE_READ_FSCREDS)) { 55 error = ns_get_path(&ns_path, task, ns_ops); 56 if (!error) 57 nd_jump_link(&ns_path); 58 } 59 put_task_struct(task); |
60 return error; | 60 return ERR_PTR(error); |
61} 62 63static int proc_ns_readlink(struct dentry *dentry, char __user *buffer, int buflen) 64{ 65 struct inode *inode = d_inode(dentry); 66 const struct proc_ns_operations *ns_ops = PROC_I(inode)->ns_ops; 67 struct task_struct *task; 68 char name[50]; --- 107 unchanged lines hidden --- | 61} 62 63static int proc_ns_readlink(struct dentry *dentry, char __user *buffer, int buflen) 64{ 65 struct inode *inode = d_inode(dentry); 66 const struct proc_ns_operations *ns_ops = PROC_I(inode)->ns_ops; 67 struct task_struct *task; 68 char name[50]; --- 107 unchanged lines hidden --- |