| .. | .. |
|---|
| 12 | 12 | struct inode *inode, |
|---|
| 13 | 13 | struct delayed_call *done) |
|---|
| 14 | 14 | { |
|---|
| 15 | | - struct pid_namespace *ns = proc_pid_ns(inode); |
|---|
| 15 | + struct pid_namespace *ns = proc_pid_ns(inode->i_sb); |
|---|
| 16 | 16 | pid_t tgid = task_tgid_nr_ns(current, ns); |
|---|
| 17 | 17 | pid_t pid = task_pid_nr_ns(current, ns); |
|---|
| 18 | 18 | char *name; |
|---|
| .. | .. |
|---|
| 36 | 36 | int proc_setup_thread_self(struct super_block *s) |
|---|
| 37 | 37 | { |
|---|
| 38 | 38 | struct inode *root_inode = d_inode(s->s_root); |
|---|
| 39 | | - struct pid_namespace *ns = proc_pid_ns(root_inode); |
|---|
| 39 | + struct proc_fs_info *fs_info = proc_sb_info(s); |
|---|
| 40 | 40 | struct dentry *thread_self; |
|---|
| 41 | + int ret = -ENOMEM; |
|---|
| 41 | 42 | |
|---|
| 42 | 43 | inode_lock(root_inode); |
|---|
| 43 | 44 | thread_self = d_alloc_name(s->s_root, "thread-self"); |
|---|
| .. | .. |
|---|
| 51 | 52 | inode->i_gid = GLOBAL_ROOT_GID; |
|---|
| 52 | 53 | inode->i_op = &proc_thread_self_inode_operations; |
|---|
| 53 | 54 | d_add(thread_self, inode); |
|---|
| 55 | + ret = 0; |
|---|
| 54 | 56 | } else { |
|---|
| 55 | 57 | dput(thread_self); |
|---|
| 56 | | - thread_self = ERR_PTR(-ENOMEM); |
|---|
| 57 | 58 | } |
|---|
| 58 | | - } else { |
|---|
| 59 | | - thread_self = ERR_PTR(-ENOMEM); |
|---|
| 60 | 59 | } |
|---|
| 61 | 60 | inode_unlock(root_inode); |
|---|
| 62 | | - if (IS_ERR(thread_self)) { |
|---|
| 63 | | - pr_err("proc_fill_super: can't allocate /proc/thread_self\n"); |
|---|
| 64 | | - return PTR_ERR(thread_self); |
|---|
| 65 | | - } |
|---|
| 66 | | - ns->proc_thread_self = thread_self; |
|---|
| 67 | | - return 0; |
|---|
| 61 | + |
|---|
| 62 | + if (ret) |
|---|
| 63 | + pr_err("proc_fill_super: can't allocate /proc/thread-self\n"); |
|---|
| 64 | + else |
|---|
| 65 | + fs_info->proc_thread_self = thread_self; |
|---|
| 66 | + |
|---|
| 67 | + return ret; |
|---|
| 68 | 68 | } |
|---|
| 69 | 69 | |
|---|
| 70 | 70 | void __init proc_thread_self_init(void) |
|---|