diff options
author | Jeff Layton <jlayton@redhat.com> | 2012-10-10 16:43:13 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-10-12 20:15:09 -0400 |
commit | adb5c2473d3f91526c79db972aafb20a56d3fbb3 (patch) | |
tree | f0427a11a91af2f5a5d0037ce52c32633019120b /fs | |
parent | 669abf4e5539c8aa48bf28c965be05c0a7b58a27 (diff) |
audit: make audit_inode take struct filename
Keep a pointer to the audit_names "slot" in struct filename.
Have all of the audit_inode callers pass a struct filename ponter to
audit_inode instead of a string pointer. If the aname field is already
populated, then we can skip walking the list altogether and just use it
directly.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/namei.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/fs/namei.c b/fs/namei.c index 6bbd8fdfb1f5..80b162b142f9 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -1999,8 +1999,7 @@ static int filename_lookup(int dfd, struct filename *name, | |||
1999 | flags | LOOKUP_REVAL, nd); | 1999 | flags | LOOKUP_REVAL, nd); |
2000 | 2000 | ||
2001 | if (likely(!retval)) | 2001 | if (likely(!retval)) |
2002 | audit_inode(name->name, nd->path.dentry, | 2002 | audit_inode(name, nd->path.dentry, flags & LOOKUP_PARENT); |
2003 | flags & LOOKUP_PARENT); | ||
2004 | return retval; | 2003 | return retval; |
2005 | } | 2004 | } |
2006 | 2005 | ||
@@ -2674,7 +2673,6 @@ static int do_last(struct nameidata *nd, struct path *path, | |||
2674 | struct path save_parent = { .dentry = NULL, .mnt = NULL }; | 2673 | struct path save_parent = { .dentry = NULL, .mnt = NULL }; |
2675 | bool retried = false; | 2674 | bool retried = false; |
2676 | int error; | 2675 | int error; |
2677 | const char *pathname = name->name; | ||
2678 | 2676 | ||
2679 | nd->flags &= ~LOOKUP_PARENT; | 2677 | nd->flags &= ~LOOKUP_PARENT; |
2680 | nd->flags |= op->intent; | 2678 | nd->flags |= op->intent; |
@@ -2690,7 +2688,7 @@ static int do_last(struct nameidata *nd, struct path *path, | |||
2690 | error = complete_walk(nd); | 2688 | error = complete_walk(nd); |
2691 | if (error) | 2689 | if (error) |
2692 | return error; | 2690 | return error; |
2693 | audit_inode(pathname, nd->path.dentry, 0); | 2691 | audit_inode(name, nd->path.dentry, 0); |
2694 | if (open_flag & O_CREAT) { | 2692 | if (open_flag & O_CREAT) { |
2695 | error = -EISDIR; | 2693 | error = -EISDIR; |
2696 | goto out; | 2694 | goto out; |
@@ -2700,7 +2698,7 @@ static int do_last(struct nameidata *nd, struct path *path, | |||
2700 | error = complete_walk(nd); | 2698 | error = complete_walk(nd); |
2701 | if (error) | 2699 | if (error) |
2702 | return error; | 2700 | return error; |
2703 | audit_inode(pathname, dir, 0); | 2701 | audit_inode(name, dir, 0); |
2704 | goto finish_open; | 2702 | goto finish_open; |
2705 | } | 2703 | } |
2706 | 2704 | ||
@@ -2729,7 +2727,7 @@ static int do_last(struct nameidata *nd, struct path *path, | |||
2729 | if (error) | 2727 | if (error) |
2730 | return error; | 2728 | return error; |
2731 | 2729 | ||
2732 | audit_inode(pathname, dir, 0); | 2730 | audit_inode(name, dir, 0); |
2733 | error = -EISDIR; | 2731 | error = -EISDIR; |
2734 | /* trailing slashes? */ | 2732 | /* trailing slashes? */ |
2735 | if (nd->last.name[nd->last.len]) | 2733 | if (nd->last.name[nd->last.len]) |
@@ -2759,7 +2757,7 @@ retry_lookup: | |||
2759 | !S_ISREG(file->f_path.dentry->d_inode->i_mode)) | 2757 | !S_ISREG(file->f_path.dentry->d_inode->i_mode)) |
2760 | will_truncate = false; | 2758 | will_truncate = false; |
2761 | 2759 | ||
2762 | audit_inode(pathname, file->f_path.dentry, 0); | 2760 | audit_inode(name, file->f_path.dentry, 0); |
2763 | goto opened; | 2761 | goto opened; |
2764 | } | 2762 | } |
2765 | 2763 | ||
@@ -2776,7 +2774,7 @@ retry_lookup: | |||
2776 | * create/update audit record if it already exists. | 2774 | * create/update audit record if it already exists. |
2777 | */ | 2775 | */ |
2778 | if (path->dentry->d_inode) | 2776 | if (path->dentry->d_inode) |
2779 | audit_inode(pathname, path->dentry, 0); | 2777 | audit_inode(name, path->dentry, 0); |
2780 | 2778 | ||
2781 | /* | 2779 | /* |
2782 | * If atomic_open() acquired write access it is dropped now due to | 2780 | * If atomic_open() acquired write access it is dropped now due to |
@@ -2841,7 +2839,7 @@ finish_lookup: | |||
2841 | error = -ENOTDIR; | 2839 | error = -ENOTDIR; |
2842 | if ((nd->flags & LOOKUP_DIRECTORY) && !nd->inode->i_op->lookup) | 2840 | if ((nd->flags & LOOKUP_DIRECTORY) && !nd->inode->i_op->lookup) |
2843 | goto out; | 2841 | goto out; |
2844 | audit_inode(pathname, nd->path.dentry, 0); | 2842 | audit_inode(name, nd->path.dentry, 0); |
2845 | finish_open: | 2843 | finish_open: |
2846 | if (!S_ISREG(nd->inode->i_mode)) | 2844 | if (!S_ISREG(nd->inode->i_mode)) |
2847 | will_truncate = false; | 2845 | will_truncate = false; |