audit: reverse arguments to audit_inode_child
[linux-2.6-block.git] / kernel / auditsc.c
index f4a7756f999cddcf344e685ea561f358812c41fd..40743af02d8f030653e58bcb6102d78f2879bd3e 100644 (file)
@@ -2147,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)
@@ -2162,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.
@@ -2174,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;
@@ -2212,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;
@@ -2244,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);