diff options
author | Jeff Layton <jlayton@redhat.com> | 2012-10-10 15:25:21 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-10-12 00:32:00 -0400 |
commit | c43a25abba97c7d87131e71db6be24b24d7791a5 (patch) | |
tree | 0fe959853254064e17805ca111838e7869720e43 | |
parent | 9cec9d68ae53aae60b4a1fca4505c75a1d026392 (diff) |
audit: reverse arguments to audit_inode_child
Most of the callers get called with an inode and dentry in the reverse
order. The compiler then has to reshuffle the arg registers and/or
stack in order to pass them on to audit_inode_child.
Reverse those arguments for a micro-optimization.
Reported-by: Eric Paris <eparis@redhat.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/btrfs/ioctl.c | 2 | ||||
-rw-r--r-- | fs/namei.c | 2 | ||||
-rw-r--r-- | include/linux/audit.h | 18 | ||||
-rw-r--r-- | include/linux/fsnotify.h | 8 | ||||
-rw-r--r-- | kernel/auditsc.c | 8 |
5 files changed, 19 insertions, 19 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index e568c472f807..49f4d59ac2c7 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -638,7 +638,7 @@ static int btrfs_may_delete(struct inode *dir,struct dentry *victim,int isdir) | |||
638 | return -ENOENT; | 638 | return -ENOENT; |
639 | 639 | ||
640 | BUG_ON(victim->d_parent->d_inode != dir); | 640 | BUG_ON(victim->d_parent->d_inode != dir); |
641 | audit_inode_child(victim, dir); | 641 | audit_inode_child(dir, victim); |
642 | 642 | ||
643 | error = inode_permission(dir, MAY_WRITE | MAY_EXEC); | 643 | error = inode_permission(dir, MAY_WRITE | MAY_EXEC); |
644 | if (error) | 644 | if (error) |
diff --git a/fs/namei.c b/fs/namei.c index f04ce1142297..a7ad35c66807 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -2176,7 +2176,7 @@ static int may_delete(struct inode *dir,struct dentry *victim,int isdir) | |||
2176 | return -ENOENT; | 2176 | return -ENOENT; |
2177 | 2177 | ||
2178 | BUG_ON(victim->d_parent->d_inode != dir); | 2178 | BUG_ON(victim->d_parent->d_inode != dir); |
2179 | audit_inode_child(victim, dir); | 2179 | audit_inode_child(dir, victim); |
2180 | 2180 | ||
2181 | error = inode_permission(dir, MAY_WRITE | MAY_EXEC); | 2181 | error = inode_permission(dir, MAY_WRITE | MAY_EXEC); |
2182 | if (error) | 2182 | if (error) |
diff --git a/include/linux/audit.h b/include/linux/audit.h index 2c83e5f7edb1..8c66fc248c75 100644 --- a/include/linux/audit.h +++ b/include/linux/audit.h | |||
@@ -464,8 +464,8 @@ extern void __audit_syscall_exit(int ret_success, long ret_value); | |||
464 | extern void __audit_getname(const char *name); | 464 | extern void __audit_getname(const char *name); |
465 | extern void audit_putname(const char *name); | 465 | extern void audit_putname(const char *name); |
466 | extern void __audit_inode(const char *name, const struct dentry *dentry); | 466 | extern void __audit_inode(const char *name, const struct dentry *dentry); |
467 | extern void __audit_inode_child(const struct dentry *dentry, | 467 | extern void __audit_inode_child(const struct inode *parent, |
468 | const struct inode *parent); | 468 | const struct dentry *dentry); |
469 | extern void __audit_seccomp(unsigned long syscall, long signr, int code); | 469 | extern void __audit_seccomp(unsigned long syscall, long signr, int code); |
470 | extern void __audit_ptrace(struct task_struct *t); | 470 | extern void __audit_ptrace(struct task_struct *t); |
471 | 471 | ||
@@ -504,10 +504,10 @@ static inline void audit_inode(const char *name, const struct dentry *dentry) { | |||
504 | if (unlikely(!audit_dummy_context())) | 504 | if (unlikely(!audit_dummy_context())) |
505 | __audit_inode(name, dentry); | 505 | __audit_inode(name, dentry); |
506 | } | 506 | } |
507 | static inline void audit_inode_child(const struct dentry *dentry, | 507 | static inline void audit_inode_child(const struct inode *parent, |
508 | const struct inode *parent) { | 508 | const struct dentry *dentry) { |
509 | if (unlikely(!audit_dummy_context())) | 509 | if (unlikely(!audit_dummy_context())) |
510 | __audit_inode_child(dentry, parent); | 510 | __audit_inode_child(parent, dentry); |
511 | } | 511 | } |
512 | void audit_core_dumps(long signr); | 512 | void audit_core_dumps(long signr); |
513 | 513 | ||
@@ -657,13 +657,13 @@ static inline void audit_putname(const char *name) | |||
657 | { } | 657 | { } |
658 | static inline void __audit_inode(const char *name, const struct dentry *dentry) | 658 | static inline void __audit_inode(const char *name, const struct dentry *dentry) |
659 | { } | 659 | { } |
660 | static inline void __audit_inode_child(const struct dentry *dentry, | 660 | static inline void __audit_inode_child(const struct inode *parent, |
661 | const struct inode *parent) | 661 | const struct dentry *dentry) |
662 | { } | 662 | { } |
663 | static inline void audit_inode(const char *name, const struct dentry *dentry) | 663 | static inline void audit_inode(const char *name, const struct dentry *dentry) |
664 | { } | 664 | { } |
665 | static inline void audit_inode_child(const struct dentry *dentry, | 665 | static inline void audit_inode_child(const struct inode *parent, |
666 | const struct inode *parent) | 666 | const struct dentry *dentry) |
667 | { } | 667 | { } |
668 | static inline void audit_core_dumps(long signr) | 668 | static inline void audit_core_dumps(long signr) |
669 | { } | 669 | { } |
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h index a6dfe6944564..9c284714977d 100644 --- a/include/linux/fsnotify.h +++ b/include/linux/fsnotify.h | |||
@@ -109,7 +109,7 @@ static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, | |||
109 | 109 | ||
110 | if (source) | 110 | if (source) |
111 | fsnotify(source, FS_MOVE_SELF, moved->d_inode, FSNOTIFY_EVENT_INODE, NULL, 0); | 111 | fsnotify(source, FS_MOVE_SELF, moved->d_inode, FSNOTIFY_EVENT_INODE, NULL, 0); |
112 | audit_inode_child(moved, new_dir); | 112 | audit_inode_child(new_dir, moved); |
113 | } | 113 | } |
114 | 114 | ||
115 | /* | 115 | /* |
@@ -155,7 +155,7 @@ static inline void fsnotify_inoderemove(struct inode *inode) | |||
155 | */ | 155 | */ |
156 | static inline void fsnotify_create(struct inode *inode, struct dentry *dentry) | 156 | static inline void fsnotify_create(struct inode *inode, struct dentry *dentry) |
157 | { | 157 | { |
158 | audit_inode_child(dentry, inode); | 158 | audit_inode_child(inode, dentry); |
159 | 159 | ||
160 | fsnotify(inode, FS_CREATE, dentry->d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0); | 160 | fsnotify(inode, FS_CREATE, dentry->d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0); |
161 | } | 161 | } |
@@ -168,7 +168,7 @@ static inline void fsnotify_create(struct inode *inode, struct dentry *dentry) | |||
168 | static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct dentry *new_dentry) | 168 | static inline void fsnotify_link(struct inode *dir, struct inode *inode, struct dentry *new_dentry) |
169 | { | 169 | { |
170 | fsnotify_link_count(inode); | 170 | fsnotify_link_count(inode); |
171 | audit_inode_child(new_dentry, dir); | 171 | audit_inode_child(dir, new_dentry); |
172 | 172 | ||
173 | fsnotify(dir, FS_CREATE, inode, FSNOTIFY_EVENT_INODE, new_dentry->d_name.name, 0); | 173 | fsnotify(dir, FS_CREATE, inode, FSNOTIFY_EVENT_INODE, new_dentry->d_name.name, 0); |
174 | } | 174 | } |
@@ -181,7 +181,7 @@ static inline void fsnotify_mkdir(struct inode *inode, struct dentry *dentry) | |||
181 | __u32 mask = (FS_CREATE | FS_ISDIR); | 181 | __u32 mask = (FS_CREATE | FS_ISDIR); |
182 | struct inode *d_inode = dentry->d_inode; | 182 | struct inode *d_inode = dentry->d_inode; |
183 | 183 | ||
184 | audit_inode_child(dentry, inode); | 184 | audit_inode_child(inode, dentry); |
185 | 185 | ||
186 | fsnotify(inode, mask, d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0); | 186 | fsnotify(inode, mask, d_inode, FSNOTIFY_EVENT_INODE, dentry->d_name.name, 0); |
187 | } | 187 | } |
diff --git a/kernel/auditsc.c b/kernel/auditsc.c index 2e481141b014..40743af02d8f 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c | |||
@@ -2166,9 +2166,9 @@ out: | |||
2166 | } | 2166 | } |
2167 | 2167 | ||
2168 | /** | 2168 | /** |
2169 | * audit_inode_child - collect inode info for created/removed objects | 2169 | * __audit_inode_child - collect inode info for created/removed objects |
2170 | * @dentry: dentry being audited | ||
2171 | * @parent: inode of dentry parent | 2170 | * @parent: inode of dentry parent |
2171 | * @dentry: dentry being audited | ||
2172 | * | 2172 | * |
2173 | * For syscalls that create or remove filesystem objects, audit_inode | 2173 | * For syscalls that create or remove filesystem objects, audit_inode |
2174 | * can only collect information for the filesystem object's parent. | 2174 | * can only collect information for the filesystem object's parent. |
@@ -2178,8 +2178,8 @@ out: | |||
2178 | * must be hooked prior, in order to capture the target inode during | 2178 | * must be hooked prior, in order to capture the target inode during |
2179 | * unsuccessful attempts. | 2179 | * unsuccessful attempts. |
2180 | */ | 2180 | */ |
2181 | void __audit_inode_child(const struct dentry *dentry, | 2181 | void __audit_inode_child(const struct inode *parent, |
2182 | const struct inode *parent) | 2182 | const struct dentry *dentry) |
2183 | { | 2183 | { |
2184 | struct audit_context *context = current->audit_context; | 2184 | struct audit_context *context = current->audit_context; |
2185 | const char *found_parent = NULL, *found_child = NULL; | 2185 | const char *found_parent = NULL, *found_child = NULL; |