audit_compare_dname_path(): switch to const struct qstr *
authorAl Viro <viro@zeniv.linux.org.uk>
Fri, 26 Apr 2019 18:11:05 +0000 (14:11 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 29 Apr 2019 00:33:43 +0000 (20:33 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
kernel/audit.h
kernel/audit_fsnotify.c
kernel/audit_watch.c
kernel/auditfilter.c
kernel/auditsc.c

index 958d5b8fc1b3c8e2c43affb346b2e89e8a188f5c..2071725a999f12663245cf80bb69dd84698d27c5 100644 (file)
@@ -231,7 +231,7 @@ extern int audit_comparator(const u32 left, const u32 op, const u32 right);
 extern int audit_uid_comparator(kuid_t left, u32 op, kuid_t right);
 extern int audit_gid_comparator(kgid_t left, u32 op, kgid_t right);
 extern int parent_len(const char *path);
-extern int audit_compare_dname_path(const char *dname, const char *path, int plen);
+extern int audit_compare_dname_path(const struct qstr *dname, const char *path, int plen);
 extern struct sk_buff *audit_make_reply(int seq, int type, int done, int multi,
                                        const void *payload, int size);
 extern void                audit_panic(const char *message);
index fb241805569c8113689e99cc8ce936ef2e748efa..b5737b826951aecf3a63dcdff88e52e60f8572c2 100644 (file)
@@ -188,7 +188,7 @@ static int audit_mark_handle_event(struct fsnotify_group *group,
        }
 
        if (mask & (FS_CREATE|FS_MOVED_TO|FS_DELETE|FS_MOVED_FROM)) {
-               if (audit_compare_dname_path(dname->name, audit_mark->path, AUDIT_NAME_FULL))
+               if (audit_compare_dname_path(dname, audit_mark->path, AUDIT_NAME_FULL))
                        return 0;
                audit_update_mark(audit_mark, inode);
        } else if (mask & (FS_DELETE_SELF|FS_UNMOUNT|FS_MOVE_SELF))
index d832ce9df065f2a5bb08d5f039745ad91c3c58db..b50c574223fa6d74cb0942a12dc48b91725fe0d4 100644 (file)
@@ -261,13 +261,12 @@ static void audit_update_watch(struct audit_parent *parent,
        struct audit_watch *owatch, *nwatch, *nextw;
        struct audit_krule *r, *nextr;
        struct audit_entry *oentry, *nentry;
-       const unsigned char *name = dname->name;
 
        mutex_lock(&audit_filter_mutex);
        /* Run all of the watches on this parent looking for the one that
         * matches the given dname */
        list_for_each_entry_safe(owatch, nextw, &parent->watches, wlist) {
-               if (audit_compare_dname_path(name, owatch->path,
+               if (audit_compare_dname_path(dname, owatch->path,
                                             AUDIT_NAME_FULL))
                        continue;
 
index 63f8b3f26fab452b171fd5ba662d3e1b801999c3..f9fff93c335156e0920baf702a489b07e9523905 100644 (file)
@@ -1290,12 +1290,12 @@ int parent_len(const char *path)
  * @parentlen: length of the parent if known. Passing in AUDIT_NAME_FULL
  *             here indicates that we must compute this value.
  */
-int audit_compare_dname_path(const char *dname, const char *path, int parentlen)
+int audit_compare_dname_path(const struct qstr *dname, const char *path, int parentlen)
 {
        int dlen, pathlen;
        const char *p;
 
-       dlen = strlen(dname);
+       dlen = dname->len;
        pathlen = strlen(path);
        if (pathlen < dlen)
                return 1;
@@ -1306,7 +1306,7 @@ int audit_compare_dname_path(const char *dname, const char *path, int parentlen)
 
        p = path + parentlen;
 
-       return strncmp(p, dname, dlen);
+       return strncmp(p, dname->name, dlen);
 }
 
 int audit_filter(int msgtype, unsigned int listtype)
index d1eab1d4a930e6f509fcddbf10ede58d1a94db6f..92d0ae63febdc52a47033a7230c84d868df90c45 100644 (file)
@@ -2045,7 +2045,7 @@ void __audit_inode_child(struct inode *parent,
 {
        struct audit_context *context = audit_context();
        struct inode *inode = d_backing_inode(dentry);
-       const char *dname = dentry->d_name.name;
+       const struct qstr *dname = &dentry->d_name;
        struct audit_names *n, *found_parent = NULL, *found_child = NULL;
        struct audit_entry *e;
        struct list_head *list = &audit_filter_list[AUDIT_FILTER_FS];
@@ -2099,7 +2099,7 @@ void __audit_inode_child(struct inode *parent,
                    (n->type != type && n->type != AUDIT_TYPE_UNKNOWN))
                        continue;
 
-               if (!strcmp(dname, n->name->name) ||
+               if (!strcmp(dname->name, n->name->name) ||
                    !audit_compare_dname_path(dname, n->name->name,
                                                found_parent ?
                                                found_parent->name_len :