char *kname;
int len;
+ result = audit_reusename(filename);
+ if (result)
+ return result;
+
/* FIXME: create dedicated slabcache? */
result = kzalloc(sizeof(*result), GFP_KERNEL);
if (unlikely(!result))
int major, unsigned long a0, unsigned long a1,
unsigned long a2, unsigned long a3);
extern void __audit_syscall_exit(int ret_success, long ret_value);
+extern struct filename *__audit_reusename(const __user char *uptr);
extern void __audit_getname(struct filename *name);
extern void audit_putname(struct filename *name);
extern void __audit_inode(const char *name, const struct dentry *dentry,
__audit_syscall_exit(success, return_code);
}
}
+static inline struct filename *audit_reusename(const __user char *name)
+{
+ if (unlikely(!audit_dummy_context()))
+ return __audit_reusename(name);
+ return NULL;
+}
static inline void audit_getname(struct filename *name)
{
if (unlikely(!audit_dummy_context()))
{
return 1;
}
+static inline struct filename *audit_reusename(const __user char *name)
+{
+ return NULL;
+}
static inline void audit_getname(struct filename *name)
{ }
static inline void audit_putname(struct filename *name)
return aname;
}
+/**
+ * audit_reusename - fill out filename with info from existing entry
+ * @uptr: userland ptr to pathname
+ *
+ * Search the audit_names list for the current audit context. If there is an
+ * existing entry with a matching "uptr" then return the filename
+ * associated with that audit_name. If not, return NULL.
+ */
+struct filename *
+__audit_reusename(const __user char *uptr)
+{
+ struct audit_context *context = current->audit_context;
+ struct audit_names *n;
+
+ list_for_each_entry(n, &context->names_list, list) {
+ if (!n->name)
+ continue;
+ if (n->name->uptr == uptr)
+ return n->name;
+ }
+ return NULL;
+}
+
/**
* audit_getname - add a name to the list
* @name: name to add