Simplify kallsyms_lookup()
[powerpc.git] / fs / proc / task_nommu.c
index 091aa8e..d8b8c71 100644 (file)
@@ -2,6 +2,7 @@
 #include <linux/mm.h>
 #include <linux/file.h>
 #include <linux/mount.h>
+#include <linux/ptrace.h>
 #include <linux/seq_file.h>
 #include "internal.h"
 
@@ -126,8 +127,8 @@ int proc_exe_link(struct inode *inode, struct dentry **dentry, struct vfsmount *
        }
 
        if (vma) {
-               *mnt = mntget(vma->vm_file->f_vfsmnt);
-               *dentry = dget(vma->vm_file->f_dentry);
+               *mnt = mntget(vma->vm_file->f_path.mnt);
+               *dentry = dget(vma->vm_file->f_path.dentry);
                result = 0;
        }
 
@@ -143,6 +144,12 @@ out:
 static int show_map(struct seq_file *m, void *_vml)
 {
        struct vm_list_struct *vml = _vml;
+       struct proc_maps_private *priv = m->private;
+       struct task_struct *task = priv->task;
+
+       if (maps_protect && !ptrace_may_attach(task))
+               return -EACCES;
+
        return nommu_vma_show(m, vml->vma);
 }
 
@@ -220,7 +227,7 @@ static int maps_open(struct inode *inode, struct file *file)
        return ret;
 }
 
-struct file_operations proc_maps_operations = {
+const struct file_operations proc_maps_operations = {
        .open           = maps_open,
        .read           = seq_read,
        .llseek         = seq_lseek,