aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorGuillaume Chazarain <guichaz@yahoo.fr>2007-02-01 02:48:14 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-01 19:22:41 -0500
commit7d8952440f4090522b740257f1c6b2cf96413969 (patch)
tree9afe525a5e3dda6ac88b533caacde21f30673ebe /fs
parent432bd6cbf9f016f5480153b1cdfbd046f8d4fb1e (diff)
[PATCH] procfs: Fix listing of /proc/NOT_A_TGID/task
Listing /proc/PID/task were PID is not a TGID should not result in duplicated entries. [g ~]$ pidof thunderbird-bin 2751 [g ~]$ ls /proc/2751/task 2751 2770 2771 2824 2826 2834 2835 2851 2853 [g ~]$ ls /proc/2770/task 2751 2770 2771 2824 2826 2834 2835 2851 2853 2770 2771 2824 2826 2834 2835 2851 2853 [g ~]$ Signed-off-by: Guillaume Chazarain <guichaz@yahoo.fr> Acked-by: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Oleg Nesterov <oleg@tv-sign.ru> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-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;