@@ -698,7 +698,7 @@ static bool has_pid_permissions(struct pid_namespace *pid,
698698
699699static int proc_pid_permission (struct inode * inode , int mask )
700700{
701- struct pid_namespace * pid = inode -> i_sb -> s_fs_info ;
701+ struct pid_namespace * pid = proc_pid_ns ( inode ) ;
702702 struct task_struct * task ;
703703 bool has_perms ;
704704
@@ -733,13 +733,11 @@ static const struct inode_operations proc_def_inode_operations = {
733733static int proc_single_show (struct seq_file * m , void * v )
734734{
735735 struct inode * inode = m -> private ;
736- struct pid_namespace * ns ;
737- struct pid * pid ;
736+ struct pid_namespace * ns = proc_pid_ns ( inode ) ;
737+ struct pid * pid = proc_pid ( inode ) ;
738738 struct task_struct * task ;
739739 int ret ;
740740
741- ns = inode -> i_sb -> s_fs_info ;
742- pid = proc_pid (inode );
743741 task = get_pid_task (pid , PIDTYPE_PID );
744742 if (!task )
745743 return - ESRCH ;
@@ -1410,7 +1408,7 @@ static const struct file_operations proc_fail_nth_operations = {
14101408static int sched_show (struct seq_file * m , void * v )
14111409{
14121410 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 ) ;
14141412 struct task_struct * p ;
14151413
14161414 p = get_proc_task (inode );
@@ -1782,8 +1780,8 @@ int pid_getattr(const struct path *path, struct kstat *stat,
17821780 u32 request_mask , unsigned int query_flags )
17831781{
17841782 struct inode * inode = d_inode (path -> dentry );
1783+ struct pid_namespace * pid = proc_pid_ns (inode );
17851784 struct task_struct * task ;
1786- struct pid_namespace * pid = path -> dentry -> d_sb -> s_fs_info ;
17871785
17881786 generic_fillattr (inode , stat );
17891787
@@ -2337,7 +2335,7 @@ static int proc_timers_open(struct inode *inode, struct file *file)
23372335 return - ENOMEM ;
23382336
23392337 tp -> pid = proc_pid (inode );
2340- tp -> ns = inode -> i_sb -> s_fs_info ;
2338+ tp -> ns = proc_pid_ns ( inode ) ;
23412339 return 0 ;
23422340}
23432341
@@ -3239,7 +3237,7 @@ static struct tgid_iter next_tgid(struct pid_namespace *ns, struct tgid_iter ite
32393237int proc_pid_readdir (struct file * file , struct dir_context * ctx )
32403238{
32413239 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 )) ;
32433241 loff_t pos = ctx -> pos ;
32443242
32453243 if (pos >= PID_MAX_LIMIT + TGID_OFFSET )
@@ -3588,7 +3586,7 @@ static int proc_task_readdir(struct file *file, struct dir_context *ctx)
35883586 /* f_version caches the tgid value that the last readdir call couldn't
35893587 * return. lseek aka telldir automagically resets f_version to 0.
35903588 */
3591- ns = inode -> i_sb -> s_fs_info ;
3589+ ns = proc_pid_ns ( inode ) ;
35923590 tid = (int )file -> f_version ;
35933591 file -> f_version = 0 ;
35943592 for (task = first_tid (proc_pid (inode ), tid , ctx -> pos - 2 , ns );
0 commit comments