diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2019-07-14 13:22:27 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2019-07-21 18:24:46 -0400 |
commit | c9b07eab0c8760bdd4cf8624c482ee145a322a3b (patch) | |
tree | 5a28592ddc747bdadcaa2ab8f0969baffa6e5f35 | |
parent | 39145f5f0cc924b494ad55a2bc9c1b4969b5a038 (diff) |
audit_inode(): switch to passing AUDIT_INODE_...
don't bother with remapping LOOKUP_... values - all callers pass
constants and we can just as well pass the right ones from the
very beginning.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/namei.c | 6 | ||||
-rw-r--r-- | include/linux/audit.h | 20 |
2 files changed, 10 insertions, 16 deletions
diff --git a/fs/namei.c b/fs/namei.c index 5b8c72dc0217..3fca26398bc2 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -2391,7 +2391,7 @@ static struct filename *filename_parentat(int dfd, struct filename *name, | |||
2391 | if (likely(!retval)) { | 2391 | if (likely(!retval)) { |
2392 | *last = nd.last; | 2392 | *last = nd.last; |
2393 | *type = nd.last_type; | 2393 | *type = nd.last_type; |
2394 | audit_inode(name, parent->dentry, LOOKUP_PARENT); | 2394 | audit_inode(name, parent->dentry, AUDIT_INODE_PARENT); |
2395 | } else { | 2395 | } else { |
2396 | putname(name); | 2396 | putname(name); |
2397 | name = ERR_PTR(retval); | 2397 | name = ERR_PTR(retval); |
@@ -2718,7 +2718,7 @@ filename_mountpoint(int dfd, struct filename *name, struct path *path, | |||
2718 | if (unlikely(error == -ESTALE)) | 2718 | if (unlikely(error == -ESTALE)) |
2719 | error = path_mountpoint(&nd, flags | LOOKUP_REVAL, path); | 2719 | error = path_mountpoint(&nd, flags | LOOKUP_REVAL, path); |
2720 | if (likely(!error)) | 2720 | if (likely(!error)) |
2721 | audit_inode(name, path->dentry, LOOKUP_NO_EVAL); | 2721 | audit_inode(name, path->dentry, AUDIT_INODE_NOEVAL); |
2722 | restore_nameidata(); | 2722 | restore_nameidata(); |
2723 | putname(name); | 2723 | putname(name); |
2724 | return error; | 2724 | return error; |
@@ -3299,7 +3299,7 @@ static int do_last(struct nameidata *nd, | |||
3299 | if (error) | 3299 | if (error) |
3300 | return error; | 3300 | return error; |
3301 | 3301 | ||
3302 | audit_inode(nd->name, dir, LOOKUP_PARENT); | 3302 | audit_inode(nd->name, dir, AUDIT_INODE_PARENT); |
3303 | /* trailing slashes? */ | 3303 | /* trailing slashes? */ |
3304 | if (unlikely(nd->last.name[nd->last.len])) | 3304 | if (unlikely(nd->last.name[nd->last.len])) |
3305 | return -EISDIR; | 3305 | return -EISDIR; |
diff --git a/include/linux/audit.h b/include/linux/audit.h index 97d0925454df..543763ab0354 100644 --- a/include/linux/audit.h +++ b/include/linux/audit.h | |||
@@ -252,6 +252,10 @@ static inline int audit_signal_info(int sig, struct task_struct *t) | |||
252 | #define audit_is_compat(arch) false | 252 | #define audit_is_compat(arch) false |
253 | #endif | 253 | #endif |
254 | 254 | ||
255 | #define AUDIT_INODE_PARENT 1 /* dentry represents the parent */ | ||
256 | #define AUDIT_INODE_HIDDEN 2 /* audit record should be hidden */ | ||
257 | #define AUDIT_INODE_NOEVAL 4 /* audit record incomplete */ | ||
258 | |||
255 | #ifdef CONFIG_AUDITSYSCALL | 259 | #ifdef CONFIG_AUDITSYSCALL |
256 | #include <asm/syscall.h> /* for syscall_get_arch() */ | 260 | #include <asm/syscall.h> /* for syscall_get_arch() */ |
257 | 261 | ||
@@ -265,9 +269,6 @@ extern void __audit_syscall_exit(int ret_success, long ret_value); | |||
265 | extern struct filename *__audit_reusename(const __user char *uptr); | 269 | extern struct filename *__audit_reusename(const __user char *uptr); |
266 | extern void __audit_getname(struct filename *name); | 270 | extern void __audit_getname(struct filename *name); |
267 | 271 | ||
268 | #define AUDIT_INODE_PARENT 1 /* dentry represents the parent */ | ||
269 | #define AUDIT_INODE_HIDDEN 2 /* audit record should be hidden */ | ||
270 | #define AUDIT_INODE_NOEVAL 4 /* audit record incomplete */ | ||
271 | extern void __audit_inode(struct filename *name, const struct dentry *dentry, | 272 | extern void __audit_inode(struct filename *name, const struct dentry *dentry, |
272 | unsigned int flags); | 273 | unsigned int flags); |
273 | extern void __audit_file(const struct file *); | 274 | extern void __audit_file(const struct file *); |
@@ -328,16 +329,9 @@ static inline void audit_getname(struct filename *name) | |||
328 | } | 329 | } |
329 | static inline void audit_inode(struct filename *name, | 330 | static inline void audit_inode(struct filename *name, |
330 | const struct dentry *dentry, | 331 | const struct dentry *dentry, |
331 | unsigned int flags) { | 332 | unsigned int aflags) { |
332 | if (unlikely(!audit_dummy_context())) { | 333 | if (unlikely(!audit_dummy_context())) |
333 | unsigned int aflags = 0; | ||
334 | |||
335 | if (flags & LOOKUP_PARENT) | ||
336 | aflags |= AUDIT_INODE_PARENT; | ||
337 | if (flags & LOOKUP_NO_EVAL) | ||
338 | aflags |= AUDIT_INODE_NOEVAL; | ||
339 | __audit_inode(name, dentry, aflags); | 334 | __audit_inode(name, dentry, aflags); |
340 | } | ||
341 | } | 335 | } |
342 | static inline void audit_file(struct file *file) | 336 | static inline void audit_file(struct file *file) |
343 | { | 337 | { |
@@ -561,7 +555,7 @@ static inline void __audit_inode_child(struct inode *parent, | |||
561 | { } | 555 | { } |
562 | static inline void audit_inode(struct filename *name, | 556 | static inline void audit_inode(struct filename *name, |
563 | const struct dentry *dentry, | 557 | const struct dentry *dentry, |
564 | unsigned int parent) | 558 | unsigned int aflags) |
565 | { } | 559 | { } |
566 | static inline void audit_file(struct file *file) | 560 | static inline void audit_file(struct file *file) |
567 | { | 561 | { |