diff options
Diffstat (limited to 'fs/proc/base.c')
-rw-r--r-- | fs/proc/base.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index 1b2ede6abcdf..29237cad19fd 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -698,7 +698,7 @@ static bool has_pid_permissions(struct pid_namespace *pid, | |||
698 | 698 | ||
699 | static int proc_pid_permission(struct inode *inode, int mask) | 699 | static int proc_pid_permission(struct inode *inode, int mask) |
700 | { | 700 | { |
701 | struct pid_namespace *pid = inode->i_sb->s_fs_info; | 701 | struct pid_namespace *pid = proc_pid_ns(inode); |
702 | struct task_struct *task; | 702 | struct task_struct *task; |
703 | bool has_perms; | 703 | bool has_perms; |
704 | 704 | ||
@@ -733,13 +733,11 @@ static const struct inode_operations proc_def_inode_operations = { | |||
733 | static int proc_single_show(struct seq_file *m, void *v) | 733 | static int proc_single_show(struct seq_file *m, void *v) |
734 | { | 734 | { |
735 | struct inode *inode = m->private; | 735 | struct inode *inode = m->private; |
736 | struct pid_namespace *ns; | 736 | struct pid_namespace *ns = proc_pid_ns(inode); |
737 | struct pid *pid; | 737 | struct pid *pid = proc_pid(inode); |
738 | struct task_struct *task; | 738 | struct task_struct *task; |
739 | int ret; | 739 | int ret; |
740 | 740 | ||
741 | ns = inode->i_sb->s_fs_info; | ||
742 | pid = proc_pid(inode); | ||
743 | task = get_pid_task(pid, PIDTYPE_PID); | 741 | task = get_pid_task(pid, PIDTYPE_PID); |
744 | if (!task) | 742 | if (!task) |
745 | return -ESRCH; | 743 | return -ESRCH; |
@@ -1410,7 +1408,7 @@ static const struct file_operations proc_fail_nth_operations = { | |||
1410 | static int sched_show(struct seq_file *m, void *v) | 1408 | static int sched_show(struct seq_file *m, void *v) |
1411 | { | 1409 | { |
1412 | struct inode *inode = m->private; | 1410 | struct inode *inode = m->private; |
1413 | struct pid_namespace *ns = inode->i_sb->s_fs_info; | 1411 | struct pid_namespace *ns = proc_pid_ns(inode); |
1414 | struct task_struct *p; | 1412 | struct task_struct *p; |
1415 | 1413 | ||
1416 | p = get_proc_task(inode); | 1414 | p = get_proc_task(inode); |
@@ -1782,8 +1780,8 @@ int pid_getattr(const struct path *path, struct kstat *stat, | |||
1782 | u32 request_mask, unsigned int query_flags) | 1780 | u32 request_mask, unsigned int query_flags) |
1783 | { | 1781 | { |
1784 | struct inode *inode = d_inode(path->dentry); | 1782 | struct inode *inode = d_inode(path->dentry); |
1783 | struct pid_namespace *pid = proc_pid_ns(inode); | ||
1785 | struct task_struct *task; | 1784 | struct task_struct *task; |
1786 | struct pid_namespace *pid = path->dentry->d_sb->s_fs_info; | ||
1787 | 1785 | ||
1788 | generic_fillattr(inode, stat); | 1786 | generic_fillattr(inode, stat); |
1789 | 1787 | ||
@@ -2337,7 +2335,7 @@ static int proc_timers_open(struct inode *inode, struct file *file) | |||
2337 | return -ENOMEM; | 2335 | return -ENOMEM; |
2338 | 2336 | ||
2339 | tp->pid = proc_pid(inode); | 2337 | tp->pid = proc_pid(inode); |
2340 | tp->ns = inode->i_sb->s_fs_info; | 2338 | tp->ns = proc_pid_ns(inode); |
2341 | return 0; | 2339 | return 0; |
2342 | } | 2340 | } |
2343 | 2341 | ||
@@ -3239,7 +3237,7 @@ retry: | |||
3239 | int proc_pid_readdir(struct file *file, struct dir_context *ctx) | 3237 | int proc_pid_readdir(struct file *file, struct dir_context *ctx) |
3240 | { | 3238 | { |
3241 | struct tgid_iter iter; | 3239 | struct tgid_iter iter; |
3242 | struct pid_namespace *ns = file_inode(file)->i_sb->s_fs_info; | 3240 | struct pid_namespace *ns = proc_pid_ns(file_inode(file)); |
3243 | loff_t pos = ctx->pos; | 3241 | loff_t pos = ctx->pos; |
3244 | 3242 | ||
3245 | if (pos >= PID_MAX_LIMIT + TGID_OFFSET) | 3243 | if (pos >= PID_MAX_LIMIT + TGID_OFFSET) |
@@ -3588,7 +3586,7 @@ static int proc_task_readdir(struct file *file, struct dir_context *ctx) | |||
3588 | /* f_version caches the tgid value that the last readdir call couldn't | 3586 | /* f_version caches the tgid value that the last readdir call couldn't |
3589 | * return. lseek aka telldir automagically resets f_version to 0. | 3587 | * return. lseek aka telldir automagically resets f_version to 0. |
3590 | */ | 3588 | */ |
3591 | ns = inode->i_sb->s_fs_info; | 3589 | ns = proc_pid_ns(inode); |
3592 | tid = (int)file->f_version; | 3590 | tid = (int)file->f_version; |
3593 | file->f_version = 0; | 3591 | file->f_version = 0; |
3594 | for (task = first_tid(proc_pid(inode), tid, ctx->pos - 2, ns); | 3592 | for (task = first_tid(proc_pid(inode), tid, ctx->pos - 2, ns); |