audit: reverse arguments to audit_inode_child
[linux-2.6-block.git] / kernel / auditsc.c
index 29e090cc0e46a45a415d133dd8977d5b1a839368..40743af02d8f030653e58bcb6102d78f2879bd3e 100644 (file)
@@ -1151,7 +1151,6 @@ void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk)
        const struct cred *cred;
        char name[sizeof(tsk->comm)];
        struct mm_struct *mm = tsk->mm;
-       struct vm_area_struct *vma;
        char *tty;
 
        if (!ab)
@@ -1191,16 +1190,8 @@ void audit_log_task_info(struct audit_buffer *ab, struct task_struct *tsk)
 
        if (mm) {
                down_read(&mm->mmap_sem);
-               vma = mm->mmap;
-               while (vma) {
-                       if ((vma->vm_flags & VM_EXECUTABLE) &&
-                           vma->vm_file) {
-                               audit_log_d_path(ab, " exe=",
-                                                &vma->vm_file->f_path);
-                               break;
-                       }
-                       vma = vma->vm_next;
-               }
+               if (mm->exe_file)
+                       audit_log_d_path(ab, " exe=", &mm->exe_file->f_path);
                up_read(&mm->mmap_sem);
        }
        audit_log_task_context(ab);
@@ -2156,11 +2147,15 @@ void __audit_inode(const char *name, const struct dentry *dentry)
        if (!context->in_syscall)
                return;
 
+       if (!name)
+               goto out_alloc;
+
        list_for_each_entry_reverse(n, &context->names_list, list) {
-               if (n->name && (n->name == name))
+               if (n->name == name)
                        goto out;
        }
 
+out_alloc:
        /* unable to find the name from a previous getname() */
        n = audit_alloc_name(context);
        if (!n)
@@ -2171,9 +2166,9 @@ out:
 }
 
 /**
- * audit_inode_child - collect inode info for created/removed objects
- * @dentry: dentry being audited
+ * __audit_inode_child - collect inode info for created/removed objects
  * @parent: inode of dentry parent
+ * @dentry: dentry being audited
  *
  * For syscalls that create or remove filesystem objects, audit_inode
  * can only collect information for the filesystem object's parent.
@@ -2183,8 +2178,8 @@ out:
  * must be hooked prior, in order to capture the target inode during
  * unsuccessful attempts.
  */
-void __audit_inode_child(const struct dentry *dentry,
-                        const struct inode *parent)
+void __audit_inode_child(const struct inode *parent,
+                        const struct dentry *dentry)
 {
        struct audit_context *context = current->audit_context;
        const char *found_parent = NULL, *found_child = NULL;
@@ -2221,7 +2216,7 @@ void __audit_inode_child(const struct dentry *dentry,
                if (!strcmp(dname, n->name) ||
                     !audit_compare_dname_path(dname, n->name, &dirlen)) {
                        if (inode)
-                               audit_copy_inode(n, NULL, inode);
+                               audit_copy_inode(n, dentry, inode);
                        else
                                n->ino = (unsigned long)-1;
                        found_child = n->name;
@@ -2253,7 +2248,7 @@ add_names:
                }
 
                if (inode)
-                       audit_copy_inode(n, NULL, inode);
+                       audit_copy_inode(n, dentry, inode);
        }
 }
 EXPORT_SYMBOL_GPL(__audit_inode_child);