hc
2024-10-16 50a212ec906f7524620675f0c57357691c26c81f
kernel/fs/proc/thread_self.c
....@@ -12,7 +12,7 @@
1212 struct inode *inode,
1313 struct delayed_call *done)
1414 {
15
- struct pid_namespace *ns = proc_pid_ns(inode);
15
+ struct pid_namespace *ns = proc_pid_ns(inode->i_sb);
1616 pid_t tgid = task_tgid_nr_ns(current, ns);
1717 pid_t pid = task_pid_nr_ns(current, ns);
1818 char *name;
....@@ -36,8 +36,9 @@
3636 int proc_setup_thread_self(struct super_block *s)
3737 {
3838 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);
4040 struct dentry *thread_self;
41
+ int ret = -ENOMEM;
4142
4243 inode_lock(root_inode);
4344 thread_self = d_alloc_name(s->s_root, "thread-self");
....@@ -51,20 +52,19 @@
5152 inode->i_gid = GLOBAL_ROOT_GID;
5253 inode->i_op = &proc_thread_self_inode_operations;
5354 d_add(thread_self, inode);
55
+ ret = 0;
5456 } else {
5557 dput(thread_self);
56
- thread_self = ERR_PTR(-ENOMEM);
5758 }
58
- } else {
59
- thread_self = ERR_PTR(-ENOMEM);
6059 }
6160 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;
6868 }
6969
7070 void __init proc_thread_self_init(void)