aboutsummaryrefslogtreecommitdiffstats
path: root/fs/proc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-11-07 17:32:45 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-11-07 17:32:45 -0500
commitad804a0b2a769a0eed29015c53fe395449c09d13 (patch)
tree3f96dd15fe24705cd8244bdb8fb81a7195f6ea04 /fs/proc
parentab9f2faf8f40604551336e5b0a18e0910a57b92c (diff)
parent5f2a2d5d423d5337a1392fa016ec23a8a4206006 (diff)
Merge branch 'akpm' (patches from Andrew)
Merge second patch-bomb from Andrew Morton: - most of the rest of MM - procfs - lib/ updates - printk updates - bitops infrastructure tweaks - checkpatch updates - nilfs2 update - signals - various other misc bits: coredump, seqfile, kexec, pidns, zlib, ipc, dma-debug, dma-mapping, ... * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (102 commits) ipc,msg: drop dst nil validation in copy_msg include/linux/zutil.h: fix usage example of zlib_adler32() panic: release stale console lock to always get the logbuf printed out dma-debug: check nents in dma_sync_sg* dma-mapping: tidy up dma_parms default handling pidns: fix set/getpriority and ioprio_set/get in PRIO_USER mode kexec: use file name as the output message prefix fs, seqfile: always allow oom killer seq_file: reuse string_escape_str() fs/seq_file: use seq_* helpers in seq_hex_dump() coredump: change zap_threads() and zap_process() to use for_each_thread() coredump: ensure all coredumping tasks have SIGNAL_GROUP_COREDUMP signal: remove jffs2_garbage_collect_thread()->allow_signal(SIGCONT) signal: introduce kernel_signal_stop() to fix jffs2_garbage_collect_thread() signal: turn dequeue_signal_lock() into kernel_dequeue_signal() signals: kill block_all_signals() and unblock_all_signals() nilfs2: fix gcc uninitialized-variable warnings in powerpc build nilfs2: fix gcc unused-but-set-variable warnings MAINTAINERS: nilfs2: add header file for tracing nilfs2: add tracepoints for analyzing reading and writing metadata files ...
Diffstat (limited to 'fs/proc')
-rw-r--r--fs/proc/array.c10
-rw-r--r--fs/proc/fd.c14
2 files changed, 16 insertions, 8 deletions
diff --git a/fs/proc/array.c b/fs/proc/array.c
index eed2050db9be..d73291f5f0fc 100644
--- a/fs/proc/array.c
+++ b/fs/proc/array.c
@@ -91,18 +91,18 @@
91static inline void task_name(struct seq_file *m, struct task_struct *p) 91static inline void task_name(struct seq_file *m, struct task_struct *p)
92{ 92{
93 char *buf; 93 char *buf;
94 size_t size;
94 char tcomm[sizeof(p->comm)]; 95 char tcomm[sizeof(p->comm)];
96 int ret;
95 97
96 get_task_comm(tcomm, p); 98 get_task_comm(tcomm, p);
97 99
98 seq_puts(m, "Name:\t"); 100 seq_puts(m, "Name:\t");
99 buf = m->buf + m->count;
100 101
101 /* Ignore error for now */ 102 size = seq_get_buf(m, &buf);
102 buf += string_escape_str(tcomm, buf, m->size - m->count, 103 ret = string_escape_str(tcomm, buf, size, ESCAPE_SPACE | ESCAPE_SPECIAL, "\n\\");
103 ESCAPE_SPACE | ESCAPE_SPECIAL, "\n\\"); 104 seq_commit(m, ret < size ? ret : -1);
104 105
105 m->count = buf - m->buf;
106 seq_putc(m, '\n'); 106 seq_putc(m, '\n');
107} 107}
108 108
diff --git a/fs/proc/fd.c b/fs/proc/fd.c
index 6e5fcd00733e..3c2a915c695a 100644
--- a/fs/proc/fd.c
+++ b/fs/proc/fd.c
@@ -291,11 +291,19 @@ static struct dentry *proc_lookupfd(struct inode *dir, struct dentry *dentry,
291 */ 291 */
292int proc_fd_permission(struct inode *inode, int mask) 292int proc_fd_permission(struct inode *inode, int mask)
293{ 293{
294 int rv = generic_permission(inode, mask); 294 struct task_struct *p;
295 int rv;
296
297 rv = generic_permission(inode, mask);
295 if (rv == 0) 298 if (rv == 0)
296 return 0; 299 return rv;
297 if (task_tgid(current) == proc_pid(inode)) 300
301 rcu_read_lock();
302 p = pid_task(proc_pid(inode), PIDTYPE_PID);
303 if (p && same_thread_group(p, current))
298 rv = 0; 304 rv = 0;
305 rcu_read_unlock();
306
299 return rv; 307 return rv;
300} 308}
301 309