summaryrefslogtreecommitdiffstats
path: root/kernel/fs/proc/fd.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/fs/proc/fd.c')
-rw-r--r--kernel/fs/proc/fd.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/kernel/fs/proc/fd.c b/kernel/fs/proc/fd.c
index 6e5fcd007..3c2a915c6 100644
--- a/kernel/fs/proc/fd.c
+++ b/kernel/fs/proc/fd.c
@@ -291,11 +291,19 @@ static struct dentry *proc_lookupfd(struct inode *dir, struct dentry *dentry,
*/
int proc_fd_permission(struct inode *inode, int mask)
{
- int rv = generic_permission(inode, mask);
+ struct task_struct *p;
+ int rv;
+
+ rv = generic_permission(inode, mask);
if (rv == 0)
- return 0;
- if (task_tgid(current) == proc_pid(inode))
+ return rv;
+
+ rcu_read_lock();
+ p = pid_task(proc_pid(inode), PIDTYPE_PID);
+ if (p && same_thread_group(p, current))
rv = 0;
+ rcu_read_unlock();
+
return rv;
}