]> Pileus Git - ~andy/linux/blobdiff - security/tomoyo/util.c
mm: use mm->exe_file instead of first VM_EXECUTABLE vma->vm_file
[~andy/linux] / security / tomoyo / util.c
index 867558c983349d144c5f46a729af55a2a72dbe0a..2952ba576fb9ceed3f64c23663a2b40f3cfbe13e 100644 (file)
@@ -949,18 +949,13 @@ bool tomoyo_path_matches_pattern(const struct tomoyo_path_info *filename,
 const char *tomoyo_get_exe(void)
 {
        struct mm_struct *mm = current->mm;
-       struct vm_area_struct *vma;
        const char *cp = NULL;
 
        if (!mm)
                return NULL;
        down_read(&mm->mmap_sem);
-       for (vma = mm->mmap; vma; vma = vma->vm_next) {
-               if ((vma->vm_flags & VM_EXECUTABLE) && vma->vm_file) {
-                       cp = tomoyo_realpath_from_path(&vma->vm_file->f_path);
-                       break;
-               }
-       }
+       if (mm->exe_file)
+               cp = tomoyo_realpath_from_path(&mm->exe_file->f_path);
        up_read(&mm->mmap_sem);
        return cp;
 }