From: Jeff Layton <jlayton@redhat.com>
To: viro@ZenIV.linux.org.uk
Cc: hch@infradead.org, eparis@redhat.com, linux-audit@redhat.com,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/3] audit: break the setup of the audit_name out of audit_inode and into separate function
Date: Fri, 26 Oct 2012 11:43:41 -0400 [thread overview]
Message-ID: <1351266222-11107-3-git-send-email-jlayton@redhat.com> (raw)
In-Reply-To: <1351266222-11107-1-git-send-email-jlayton@redhat.com>
When we have 2 variants of __audit_inode then they can each call this
function to do the setup.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
kernel/auditsc.c | 27 ++++++++++++++++-----------
1 file changed, 16 insertions(+), 11 deletions(-)
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 6a6d95a..9a65af0 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -2160,6 +2160,21 @@ static void audit_copy_inode(struct audit_names *name,
security_inode_getsecid(inode, &name->osid);
}
+static void audit_names_setup(struct audit_names *n,
+ const struct dentry *dentry, unsigned int parent)
+{
+ if (parent) {
+ n->name_len = n->name ? parent_len(n->name->name) : AUDIT_NAME_FULL;
+ n->type = AUDIT_TYPE_PARENT;
+ } else {
+ n->name_len = AUDIT_NAME_FULL;
+ n->type = AUDIT_TYPE_NORMAL;
+ }
+ handle_path(dentry);
+ audit_copy_inode(n, dentry->d_inode);
+ audit_copy_fcaps(n, dentry);
+}
+
/**
* __audit_inode - store the inode and device from a lookup
* @name: name being audited
@@ -2170,7 +2185,6 @@ void __audit_inode(struct filename *name, const struct dentry *dentry,
unsigned int parent)
{
struct audit_context *context = current->audit_context;
- const struct inode *inode = dentry->d_inode;
struct audit_names *n;
if (!context->in_syscall)
@@ -2223,16 +2237,7 @@ out_alloc:
if (!n)
return;
out:
- if (parent) {
- n->name_len = n->name ? parent_len(n->name->name) : AUDIT_NAME_FULL;
- n->type = AUDIT_TYPE_PARENT;
- } else {
- n->name_len = AUDIT_NAME_FULL;
- n->type = AUDIT_TYPE_NORMAL;
- }
- handle_path(dentry);
- audit_copy_inode(n, inode);
- audit_copy_fcaps(n, dentry);
+ audit_names_setup(n, dentry, parent);
}
/**
--
1.7.11.7
next prev parent reply other threads:[~2012-10-26 15:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-26 15:43 [PATCH 0/3] audit: minor audit cleanups Jeff Layton
2012-10-26 15:43 ` [PATCH 1/3] audit: eliminate optional dentry argument to audit_copy_inode Jeff Layton
2012-10-26 15:43 ` Jeff Layton [this message]
2012-10-26 15:43 ` [PATCH 3/3] audit: break up __audit_inode into two functions Jeff Layton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1351266222-11107-3-git-send-email-jlayton@redhat.com \
--to=jlayton@redhat.com \
--cc=eparis@redhat.com \
--cc=hch@infradead.org \
--cc=linux-audit@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@ZenIV.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).