summaryrefslogtreecommitdiff
path: root/security/lsm_audit.c
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2011-04-25 12:54:27 -0400
committerEric Paris <eparis@redhat.com>2011-04-25 18:13:15 -0400
commitf48b7399840b453e7282b523f535561fe9638a2d (patch)
tree29eed009469d35473367708ea60b9c5b01fc0c5f /security/lsm_audit.c
parent0dc1ba24f7fff659725eecbba2c9ad679a0954cd (diff)
downloadlinux-3.10-f48b7399840b453e7282b523f535561fe9638a2d.tar.gz
linux-3.10-f48b7399840b453e7282b523f535561fe9638a2d.tar.bz2
linux-3.10-f48b7399840b453e7282b523f535561fe9638a2d.zip
LSM: split LSM_AUDIT_DATA_FS into _PATH and _INODE
The lsm common audit code has wacky contortions making sure which pieces of information are set based on if it was given a path, dentry, or inode. Split this into path and inode to get rid of some of the code complexity. Signed-off-by: Eric Paris <eparis@redhat.com> Acked-by: Casey Schaufler <casey@schaufler-ca.com>
Diffstat (limited to 'security/lsm_audit.c')
-rw-r--r--security/lsm_audit.c50
1 files changed, 28 insertions, 22 deletions
diff --git a/security/lsm_audit.c b/security/lsm_audit.c
index 908aa712816..2e846052cbf 100644
--- a/security/lsm_audit.c
+++ b/security/lsm_audit.c
@@ -210,7 +210,6 @@ static inline void print_ipv4_addr(struct audit_buffer *ab, __be32 addr,
static void dump_common_audit_data(struct audit_buffer *ab,
struct common_audit_data *a)
{
- struct inode *inode = NULL;
struct task_struct *tsk = current;
if (a->tsk)
@@ -229,33 +228,40 @@ static void dump_common_audit_data(struct audit_buffer *ab,
case LSM_AUDIT_DATA_CAP:
audit_log_format(ab, " capability=%d ", a->u.cap);
break;
- case LSM_AUDIT_DATA_FS:
- if (a->u.fs.path.dentry) {
- struct dentry *dentry = a->u.fs.path.dentry;
- if (a->u.fs.path.mnt) {
- audit_log_d_path(ab, "path=", &a->u.fs.path);
- } else {
- audit_log_format(ab, " name=");
- audit_log_untrustedstring(ab,
- dentry->d_name.name);
- }
- inode = dentry->d_inode;
- } else if (a->u.fs.inode) {
- struct dentry *dentry;
- inode = a->u.fs.inode;
- dentry = d_find_alias(inode);
- if (dentry) {
- audit_log_format(ab, " name=");
- audit_log_untrustedstring(ab,
- dentry->d_name.name);
- dput(dentry);
- }
+ case LSM_AUDIT_DATA_PATH: {
+ struct dentry *dentry = a->u.path.dentry;
+ struct inode *inode;
+
+ if (a->u.path.mnt) {
+ audit_log_d_path(ab, "path=", &a->u.path);
+ } else {
+ audit_log_format(ab, " name=");
+ audit_log_untrustedstring(ab,
+ dentry->d_name.name);
}
+ inode = dentry->d_inode;
if (inode)
audit_log_format(ab, " dev=%s ino=%lu",
inode->i_sb->s_id,
inode->i_ino);
break;
+ }
+ case LSM_AUDIT_DATA_INODE: {
+ struct dentry *dentry;
+ struct inode *inode;
+
+ inode = a->u.inode;
+ dentry = d_find_alias(inode);
+ if (dentry) {
+ audit_log_format(ab, " name=");
+ audit_log_untrustedstring(ab,
+ dentry->d_name.name);
+ dput(dentry);
+ }
+ audit_log_format(ab, " dev=%s ino=%lu", inode->i_sb->s_id,
+ inode->i_ino);
+ break;
+ }
case LSM_AUDIT_DATA_TASK:
tsk = a->u.tsk;
if (tsk && tsk->pid) {