aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/proc/base.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c
index ff7a66850602..1a979ea3b379 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -2328,13 +2328,23 @@ static int proc_task_readdir(struct file * filp, void * dirent, filldir_t filldi
2328{ 2328{
2329 struct dentry *dentry = filp->f_path.dentry; 2329 struct dentry *dentry = filp->f_path.dentry;
2330 struct inode *inode = dentry->d_inode; 2330 struct inode *inode = dentry->d_inode;
2331 struct task_struct *leader = get_proc_task(inode); 2331 struct task_struct *leader = NULL;
2332 struct task_struct *task; 2332 struct task_struct *task;
2333 int retval = -ENOENT; 2333 int retval = -ENOENT;
2334 ino_t ino; 2334 ino_t ino;
2335 int tid; 2335 int tid;
2336 unsigned long pos = filp->f_pos; /* avoiding "long long" filp->f_pos */ 2336 unsigned long pos = filp->f_pos; /* avoiding "long long" filp->f_pos */
2337 2337
2338 task = get_proc_task(inode);
2339 if (!task)
2340 goto out_no_task;
2341 rcu_read_lock();
2342 if (pid_alive(task)) {
2343 leader = task->group_leader;
2344 get_task_struct(leader);
2345 }
2346 rcu_read_unlock();
2347 put_task_struct(task);
2338 if (!leader) 2348 if (!leader)
2339 goto out_no_task; 2349 goto out_no_task;
2340 retval = 0; 2350 retval = 0;