fsnotify: switch send_to_group() and ->handle_event to const struct qstr *
authorAl Viro <viro@zeniv.linux.org.uk>
Fri, 26 Apr 2019 17:51:03 +0000 (13:51 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Fri, 26 Apr 2019 17:51:03 +0000 (13:51 -0400)
note that conditions surrounding accesses to dname in audit_watch_handle_event()
and audit_mark_handle_event() guarantee that dname won't have been NULL.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/notify/dnotify/dnotify.c
fs/notify/fanotify/fanotify.c
fs/notify/fsnotify.c
fs/notify/inotify/inotify.h
fs/notify/inotify/inotify_fsnotify.c
include/linux/fsnotify_backend.h
kernel/audit_fsnotify.c
kernel/audit_tree.c
kernel/audit_watch.c

index 58d77dc696eb5b804a228b8ba8f74758c3bc164d..250369d6901de7d9050d1f8b57b6f6261f77aa6a 100644 (file)
@@ -81,7 +81,7 @@ static void dnotify_recalc_inode_mask(struct fsnotify_mark *fsn_mark)
 static int dnotify_handle_event(struct fsnotify_group *group,
                                struct inode *inode,
                                u32 mask, const void *data, int data_type,
-                               const unsigned char *file_name, u32 cookie,
+                               const struct qstr *file_name, u32 cookie,
                                struct fsnotify_iter_info *iter_info)
 {
        struct fsnotify_mark *inode_mark = fsnotify_iter_inode_mark(iter_info);
index 6b9c27548997162420250a1dfc810b4d293e3436..a34d7e003d7da6bb49aba0443fda337d4a48bf7a 100644 (file)
@@ -361,7 +361,7 @@ static __kernel_fsid_t fanotify_get_fsid(struct fsnotify_iter_info *iter_info)
 static int fanotify_handle_event(struct fsnotify_group *group,
                                 struct inode *inode,
                                 u32 mask, const void *data, int data_type,
-                                const unsigned char *file_name, u32 cookie,
+                                const struct qstr *file_name, u32 cookie,
                                 struct fsnotify_iter_info *iter_info)
 {
        int ret = 0;
index 9cbb5ae11d2f8b5d1878a5b4092991faa3f12540..5433e37fb0c52e7629a6d209325252900d0f6f24 100644 (file)
@@ -195,7 +195,7 @@ EXPORT_SYMBOL_GPL(__fsnotify_parent);
 static int send_to_group(struct inode *to_tell,
                         __u32 mask, const void *data,
                         int data_is, u32 cookie,
-                        const unsigned char *file_name,
+                        const struct qstr *file_name,
                         struct fsnotify_iter_info *iter_info)
 {
        struct fsnotify_group *group = NULL;
@@ -379,7 +379,7 @@ int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is,
         */
        while (fsnotify_iter_select_report_types(&iter_info)) {
                ret = send_to_group(to_tell, mask, data, data_is, cookie,
-                                   file_name->name, &iter_info);
+                                   file_name, &iter_info);
 
                if (ret && (mask & ALL_FSNOTIFY_PERM_EVENTS))
                        goto out;
index 74ae6030518989584a4471b07dc1e57ecd25cb9f..3f246f7b8a92b2199469f3a76f35f5783af1cc79 100644 (file)
@@ -27,7 +27,7 @@ extern void inotify_ignored_and_remove_idr(struct fsnotify_mark *fsn_mark,
 extern int inotify_handle_event(struct fsnotify_group *group,
                                struct inode *inode,
                                u32 mask, const void *data, int data_type,
-                               const unsigned char *file_name, u32 cookie,
+                               const struct qstr *file_name, u32 cookie,
                                struct fsnotify_iter_info *iter_info);
 
 extern const struct fsnotify_ops inotify_fsnotify_ops;
index ff30abd6a49b1ad6d93e9ddc3b54c3b7c5ab2d74..e87f012cbff725cab7c08ed7d1c034bed3df6a4d 100644 (file)
@@ -67,7 +67,7 @@ static int inotify_merge(struct list_head *list,
 int inotify_handle_event(struct fsnotify_group *group,
                         struct inode *inode,
                         u32 mask, const void *data, int data_type,
-                        const unsigned char *file_name, u32 cookie,
+                        const struct qstr *file_name, u32 cookie,
                         struct fsnotify_iter_info *iter_info)
 {
        struct fsnotify_mark *inode_mark = fsnotify_iter_inode_mark(iter_info);
@@ -89,7 +89,7 @@ int inotify_handle_event(struct fsnotify_group *group,
                        return 0;
        }
        if (file_name) {
-               len = strlen(file_name);
+               len = strlen(file_name->name);
                alloc_len += len + 1;
        }
 
@@ -129,7 +129,7 @@ int inotify_handle_event(struct fsnotify_group *group,
        event->sync_cookie = cookie;
        event->name_len = len;
        if (len)
-               strcpy(event->name, file_name);
+               strcpy(event->name, file_name->name);
 
        ret = fsnotify_add_event(group, fsn_event, inotify_merge);
        if (ret) {
index 7eb7821766d54f516ed2b325caa0fb9c257c5e24..c28f6ed1f59b82302b0a733090fecfb42bc1436c 100644 (file)
@@ -117,7 +117,7 @@ struct fsnotify_ops {
        int (*handle_event)(struct fsnotify_group *group,
                            struct inode *inode,
                            u32 mask, const void *data, int data_type,
-                           const unsigned char *file_name, u32 cookie,
+                           const struct qstr *file_name, u32 cookie,
                            struct fsnotify_iter_info *iter_info);
        void (*free_group_priv)(struct fsnotify_group *group);
        void (*freeing_mark)(struct fsnotify_mark *mark, struct fsnotify_group *group);
index 37ae95cfb7f45aa8ce2a8eb92cb15f15dc4eddc6..fb241805569c8113689e99cc8ce936ef2e748efa 100644 (file)
@@ -164,7 +164,7 @@ static void audit_autoremove_mark_rule(struct audit_fsnotify_mark *audit_mark)
 static int audit_mark_handle_event(struct fsnotify_group *group,
                                    struct inode *to_tell,
                                    u32 mask, const void *data, int data_type,
-                                   const unsigned char *dname, u32 cookie,
+                                   const struct qstr *dname, u32 cookie,
                                    struct fsnotify_iter_info *iter_info)
 {
        struct fsnotify_mark *inode_mark = fsnotify_iter_inode_mark(iter_info);
@@ -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, audit_mark->path, AUDIT_NAME_FULL))
+               if (audit_compare_dname_path(dname->name, 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 abfb112f26aa41e8efe8fe1824bd1f7785057999..e49c912f862d0e6a5d2e6b0f217af92abe2400b5 100644 (file)
@@ -1040,7 +1040,7 @@ static void evict_chunk(struct audit_chunk *chunk)
 static int audit_tree_handle_event(struct fsnotify_group *group,
                                   struct inode *to_tell,
                                   u32 mask, const void *data, int data_type,
-                                  const unsigned char *file_name, u32 cookie,
+                                  const struct qstr *file_name, u32 cookie,
                                   struct fsnotify_iter_info *iter_info)
 {
        return 0;
index e8d1adeb22230b1df4a33762fb17f0f7f014668e..3c12fd5b680e5596cc0ae60beed728647c32a72b 100644 (file)
@@ -482,7 +482,7 @@ void audit_remove_watch_rule(struct audit_krule *krule)
 static int audit_watch_handle_event(struct fsnotify_group *group,
                                    struct inode *to_tell,
                                    u32 mask, const void *data, int data_type,
-                                   const unsigned char *dname, u32 cookie,
+                                   const struct qstr *dname, u32 cookie,
                                    struct fsnotify_iter_info *iter_info)
 {
        struct fsnotify_mark *inode_mark = fsnotify_iter_inode_mark(iter_info);
@@ -507,9 +507,9 @@ static int audit_watch_handle_event(struct fsnotify_group *group,
        }
 
        if (mask & (FS_CREATE|FS_MOVED_TO) && inode)
-               audit_update_watch(parent, dname, inode->i_sb->s_dev, inode->i_ino, 0);
+               audit_update_watch(parent, dname->name, inode->i_sb->s_dev, inode->i_ino, 0);
        else if (mask & (FS_DELETE|FS_MOVED_FROM))
-               audit_update_watch(parent, dname, AUDIT_DEV_UNSET, AUDIT_INO_UNSET, 1);
+               audit_update_watch(parent, dname->name, AUDIT_DEV_UNSET, AUDIT_INO_UNSET, 1);
        else if (mask & (FS_DELETE_SELF|FS_UNMOUNT|FS_MOVE_SELF))
                audit_remove_parent_watches(parent);