lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1351266222-11107-3-git-send-email-jlayton@redhat.com>
Date:	Fri, 26 Oct 2012 11:43:41 -0400
From:	Jeff Layton <jlayton@...hat.com>
To:	viro@...IV.linux.org.uk
Cc:	hch@...radead.org, eparis@...hat.com, linux-audit@...hat.com,
	linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 2/3] audit: break the setup of the audit_name out of audit_inode and into separate function

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@...hat.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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ