diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2019-04-26 13:51:03 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2019-04-26 13:51:03 -0400 |
commit | e43e9c339a78a0978f4ce473f645cedc05e6a57c (patch) | |
tree | 1c9ec4b07f5c6e734c749ff1ed1e1055b35ef466 | |
parent | 25b229dff4ffffd0fad2dd409faf1e2ae4d94866 (diff) |
fsnotify: switch send_to_group() and ->handle_event to const struct qstr *
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>
-rw-r--r-- | fs/notify/dnotify/dnotify.c | 2 | ||||
-rw-r--r-- | fs/notify/fanotify/fanotify.c | 2 | ||||
-rw-r--r-- | fs/notify/fsnotify.c | 4 | ||||
-rw-r--r-- | fs/notify/inotify/inotify.h | 2 | ||||
-rw-r--r-- | fs/notify/inotify/inotify_fsnotify.c | 6 | ||||
-rw-r--r-- | include/linux/fsnotify_backend.h | 2 | ||||
-rw-r--r-- | kernel/audit_fsnotify.c | 4 | ||||
-rw-r--r-- | kernel/audit_tree.c | 2 | ||||
-rw-r--r-- | kernel/audit_watch.c | 6 |
9 files changed, 15 insertions, 15 deletions
diff --git a/fs/notify/dnotify/dnotify.c b/fs/notify/dnotify/dnotify.c index 58d77dc696eb..250369d6901d 100644 --- a/fs/notify/dnotify/dnotify.c +++ b/fs/notify/dnotify/dnotify.c | |||
@@ -81,7 +81,7 @@ static void dnotify_recalc_inode_mask(struct fsnotify_mark *fsn_mark) | |||
81 | static int dnotify_handle_event(struct fsnotify_group *group, | 81 | static int dnotify_handle_event(struct fsnotify_group *group, |
82 | struct inode *inode, | 82 | struct inode *inode, |
83 | u32 mask, const void *data, int data_type, | 83 | u32 mask, const void *data, int data_type, |
84 | const unsigned char *file_name, u32 cookie, | 84 | const struct qstr *file_name, u32 cookie, |
85 | struct fsnotify_iter_info *iter_info) | 85 | struct fsnotify_iter_info *iter_info) |
86 | { | 86 | { |
87 | struct fsnotify_mark *inode_mark = fsnotify_iter_inode_mark(iter_info); | 87 | struct fsnotify_mark *inode_mark = fsnotify_iter_inode_mark(iter_info); |
diff --git a/fs/notify/fanotify/fanotify.c b/fs/notify/fanotify/fanotify.c index 6b9c27548997..a34d7e003d7d 100644 --- a/fs/notify/fanotify/fanotify.c +++ b/fs/notify/fanotify/fanotify.c | |||
@@ -361,7 +361,7 @@ static __kernel_fsid_t fanotify_get_fsid(struct fsnotify_iter_info *iter_info) | |||
361 | static int fanotify_handle_event(struct fsnotify_group *group, | 361 | static int fanotify_handle_event(struct fsnotify_group *group, |
362 | struct inode *inode, | 362 | struct inode *inode, |
363 | u32 mask, const void *data, int data_type, | 363 | u32 mask, const void *data, int data_type, |
364 | const unsigned char *file_name, u32 cookie, | 364 | const struct qstr *file_name, u32 cookie, |
365 | struct fsnotify_iter_info *iter_info) | 365 | struct fsnotify_iter_info *iter_info) |
366 | { | 366 | { |
367 | int ret = 0; | 367 | int ret = 0; |
diff --git a/fs/notify/fsnotify.c b/fs/notify/fsnotify.c index 9cbb5ae11d2f..5433e37fb0c5 100644 --- a/fs/notify/fsnotify.c +++ b/fs/notify/fsnotify.c | |||
@@ -195,7 +195,7 @@ EXPORT_SYMBOL_GPL(__fsnotify_parent); | |||
195 | static int send_to_group(struct inode *to_tell, | 195 | static int send_to_group(struct inode *to_tell, |
196 | __u32 mask, const void *data, | 196 | __u32 mask, const void *data, |
197 | int data_is, u32 cookie, | 197 | int data_is, u32 cookie, |
198 | const unsigned char *file_name, | 198 | const struct qstr *file_name, |
199 | struct fsnotify_iter_info *iter_info) | 199 | struct fsnotify_iter_info *iter_info) |
200 | { | 200 | { |
201 | struct fsnotify_group *group = NULL; | 201 | struct fsnotify_group *group = NULL; |
@@ -379,7 +379,7 @@ int fsnotify(struct inode *to_tell, __u32 mask, const void *data, int data_is, | |||
379 | */ | 379 | */ |
380 | while (fsnotify_iter_select_report_types(&iter_info)) { | 380 | while (fsnotify_iter_select_report_types(&iter_info)) { |
381 | ret = send_to_group(to_tell, mask, data, data_is, cookie, | 381 | ret = send_to_group(to_tell, mask, data, data_is, cookie, |
382 | file_name->name, &iter_info); | 382 | file_name, &iter_info); |
383 | 383 | ||
384 | if (ret && (mask & ALL_FSNOTIFY_PERM_EVENTS)) | 384 | if (ret && (mask & ALL_FSNOTIFY_PERM_EVENTS)) |
385 | goto out; | 385 | goto out; |
diff --git a/fs/notify/inotify/inotify.h b/fs/notify/inotify/inotify.h index 74ae60305189..3f246f7b8a92 100644 --- a/fs/notify/inotify/inotify.h +++ b/fs/notify/inotify/inotify.h | |||
@@ -27,7 +27,7 @@ extern void inotify_ignored_and_remove_idr(struct fsnotify_mark *fsn_mark, | |||
27 | extern int inotify_handle_event(struct fsnotify_group *group, | 27 | extern int inotify_handle_event(struct fsnotify_group *group, |
28 | struct inode *inode, | 28 | struct inode *inode, |
29 | u32 mask, const void *data, int data_type, | 29 | u32 mask, const void *data, int data_type, |
30 | const unsigned char *file_name, u32 cookie, | 30 | const struct qstr *file_name, u32 cookie, |
31 | struct fsnotify_iter_info *iter_info); | 31 | struct fsnotify_iter_info *iter_info); |
32 | 32 | ||
33 | extern const struct fsnotify_ops inotify_fsnotify_ops; | 33 | extern const struct fsnotify_ops inotify_fsnotify_ops; |
diff --git a/fs/notify/inotify/inotify_fsnotify.c b/fs/notify/inotify/inotify_fsnotify.c index ff30abd6a49b..e87f012cbff7 100644 --- a/fs/notify/inotify/inotify_fsnotify.c +++ b/fs/notify/inotify/inotify_fsnotify.c | |||
@@ -67,7 +67,7 @@ static int inotify_merge(struct list_head *list, | |||
67 | int inotify_handle_event(struct fsnotify_group *group, | 67 | int inotify_handle_event(struct fsnotify_group *group, |
68 | struct inode *inode, | 68 | struct inode *inode, |
69 | u32 mask, const void *data, int data_type, | 69 | u32 mask, const void *data, int data_type, |
70 | const unsigned char *file_name, u32 cookie, | 70 | const struct qstr *file_name, u32 cookie, |
71 | struct fsnotify_iter_info *iter_info) | 71 | struct fsnotify_iter_info *iter_info) |
72 | { | 72 | { |
73 | struct fsnotify_mark *inode_mark = fsnotify_iter_inode_mark(iter_info); | 73 | struct fsnotify_mark *inode_mark = fsnotify_iter_inode_mark(iter_info); |
@@ -89,7 +89,7 @@ int inotify_handle_event(struct fsnotify_group *group, | |||
89 | return 0; | 89 | return 0; |
90 | } | 90 | } |
91 | if (file_name) { | 91 | if (file_name) { |
92 | len = strlen(file_name); | 92 | len = strlen(file_name->name); |
93 | alloc_len += len + 1; | 93 | alloc_len += len + 1; |
94 | } | 94 | } |
95 | 95 | ||
@@ -129,7 +129,7 @@ int inotify_handle_event(struct fsnotify_group *group, | |||
129 | event->sync_cookie = cookie; | 129 | event->sync_cookie = cookie; |
130 | event->name_len = len; | 130 | event->name_len = len; |
131 | if (len) | 131 | if (len) |
132 | strcpy(event->name, file_name); | 132 | strcpy(event->name, file_name->name); |
133 | 133 | ||
134 | ret = fsnotify_add_event(group, fsn_event, inotify_merge); | 134 | ret = fsnotify_add_event(group, fsn_event, inotify_merge); |
135 | if (ret) { | 135 | if (ret) { |
diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h index 7eb7821766d5..c28f6ed1f59b 100644 --- a/include/linux/fsnotify_backend.h +++ b/include/linux/fsnotify_backend.h | |||
@@ -117,7 +117,7 @@ struct fsnotify_ops { | |||
117 | int (*handle_event)(struct fsnotify_group *group, | 117 | int (*handle_event)(struct fsnotify_group *group, |
118 | struct inode *inode, | 118 | struct inode *inode, |
119 | u32 mask, const void *data, int data_type, | 119 | u32 mask, const void *data, int data_type, |
120 | const unsigned char *file_name, u32 cookie, | 120 | const struct qstr *file_name, u32 cookie, |
121 | struct fsnotify_iter_info *iter_info); | 121 | struct fsnotify_iter_info *iter_info); |
122 | void (*free_group_priv)(struct fsnotify_group *group); | 122 | void (*free_group_priv)(struct fsnotify_group *group); |
123 | void (*freeing_mark)(struct fsnotify_mark *mark, struct fsnotify_group *group); | 123 | void (*freeing_mark)(struct fsnotify_mark *mark, struct fsnotify_group *group); |
diff --git a/kernel/audit_fsnotify.c b/kernel/audit_fsnotify.c index 37ae95cfb7f4..fb241805569c 100644 --- a/kernel/audit_fsnotify.c +++ b/kernel/audit_fsnotify.c | |||
@@ -164,7 +164,7 @@ static void audit_autoremove_mark_rule(struct audit_fsnotify_mark *audit_mark) | |||
164 | static int audit_mark_handle_event(struct fsnotify_group *group, | 164 | static int audit_mark_handle_event(struct fsnotify_group *group, |
165 | struct inode *to_tell, | 165 | struct inode *to_tell, |
166 | u32 mask, const void *data, int data_type, | 166 | u32 mask, const void *data, int data_type, |
167 | const unsigned char *dname, u32 cookie, | 167 | const struct qstr *dname, u32 cookie, |
168 | struct fsnotify_iter_info *iter_info) | 168 | struct fsnotify_iter_info *iter_info) |
169 | { | 169 | { |
170 | struct fsnotify_mark *inode_mark = fsnotify_iter_inode_mark(iter_info); | 170 | 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, | |||
188 | } | 188 | } |
189 | 189 | ||
190 | if (mask & (FS_CREATE|FS_MOVED_TO|FS_DELETE|FS_MOVED_FROM)) { | 190 | if (mask & (FS_CREATE|FS_MOVED_TO|FS_DELETE|FS_MOVED_FROM)) { |
191 | if (audit_compare_dname_path(dname, audit_mark->path, AUDIT_NAME_FULL)) | 191 | if (audit_compare_dname_path(dname->name, audit_mark->path, AUDIT_NAME_FULL)) |
192 | return 0; | 192 | return 0; |
193 | audit_update_mark(audit_mark, inode); | 193 | audit_update_mark(audit_mark, inode); |
194 | } else if (mask & (FS_DELETE_SELF|FS_UNMOUNT|FS_MOVE_SELF)) | 194 | } else if (mask & (FS_DELETE_SELF|FS_UNMOUNT|FS_MOVE_SELF)) |
diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c index abfb112f26aa..e49c912f862d 100644 --- a/kernel/audit_tree.c +++ b/kernel/audit_tree.c | |||
@@ -1040,7 +1040,7 @@ static void evict_chunk(struct audit_chunk *chunk) | |||
1040 | static int audit_tree_handle_event(struct fsnotify_group *group, | 1040 | static int audit_tree_handle_event(struct fsnotify_group *group, |
1041 | struct inode *to_tell, | 1041 | struct inode *to_tell, |
1042 | u32 mask, const void *data, int data_type, | 1042 | u32 mask, const void *data, int data_type, |
1043 | const unsigned char *file_name, u32 cookie, | 1043 | const struct qstr *file_name, u32 cookie, |
1044 | struct fsnotify_iter_info *iter_info) | 1044 | struct fsnotify_iter_info *iter_info) |
1045 | { | 1045 | { |
1046 | return 0; | 1046 | return 0; |
diff --git a/kernel/audit_watch.c b/kernel/audit_watch.c index e8d1adeb2223..3c12fd5b680e 100644 --- a/kernel/audit_watch.c +++ b/kernel/audit_watch.c | |||
@@ -482,7 +482,7 @@ void audit_remove_watch_rule(struct audit_krule *krule) | |||
482 | static int audit_watch_handle_event(struct fsnotify_group *group, | 482 | static int audit_watch_handle_event(struct fsnotify_group *group, |
483 | struct inode *to_tell, | 483 | struct inode *to_tell, |
484 | u32 mask, const void *data, int data_type, | 484 | u32 mask, const void *data, int data_type, |
485 | const unsigned char *dname, u32 cookie, | 485 | const struct qstr *dname, u32 cookie, |
486 | struct fsnotify_iter_info *iter_info) | 486 | struct fsnotify_iter_info *iter_info) |
487 | { | 487 | { |
488 | struct fsnotify_mark *inode_mark = fsnotify_iter_inode_mark(iter_info); | 488 | 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, | |||
507 | } | 507 | } |
508 | 508 | ||
509 | if (mask & (FS_CREATE|FS_MOVED_TO) && inode) | 509 | if (mask & (FS_CREATE|FS_MOVED_TO) && inode) |
510 | audit_update_watch(parent, dname, inode->i_sb->s_dev, inode->i_ino, 0); | 510 | audit_update_watch(parent, dname->name, inode->i_sb->s_dev, inode->i_ino, 0); |
511 | else if (mask & (FS_DELETE|FS_MOVED_FROM)) | 511 | else if (mask & (FS_DELETE|FS_MOVED_FROM)) |
512 | audit_update_watch(parent, dname, AUDIT_DEV_UNSET, AUDIT_INO_UNSET, 1); | 512 | audit_update_watch(parent, dname->name, AUDIT_DEV_UNSET, AUDIT_INO_UNSET, 1); |
513 | else if (mask & (FS_DELETE_SELF|FS_UNMOUNT|FS_MOVE_SELF)) | 513 | else if (mask & (FS_DELETE_SELF|FS_UNMOUNT|FS_MOVE_SELF)) |
514 | audit_remove_parent_watches(parent); | 514 | audit_remove_parent_watches(parent); |
515 | 515 | ||