linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 1/3] audit: eliminate optional dentry argument to audit_copy_inode
Date: Fri, 26 Oct 2012 11:43:40 -0400	[thread overview]
Message-ID: <1351266222-11107-2-git-send-email-jlayton@redhat.com> (raw)
In-Reply-To: <1351266222-11107-1-git-send-email-jlayton@redhat.com>

Just have callers that are passing in a dentry call audit_copy_fcaps
themselves after audit_copy_inode returns.

Reported-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
 kernel/auditsc.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 2f186ed..6a6d95a 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -2148,7 +2148,7 @@ static inline int audit_copy_fcaps(struct audit_names *name, const struct dentry
 
 
 /* Copy inode data into an audit_names. */
-static void audit_copy_inode(struct audit_names *name, const struct dentry *dentry,
+static void audit_copy_inode(struct audit_names *name,
 			     const struct inode *inode)
 {
 	name->ino   = inode->i_ino;
@@ -2158,7 +2158,6 @@ static void audit_copy_inode(struct audit_names *name, const struct dentry *dent
 	name->gid   = inode->i_gid;
 	name->rdev  = inode->i_rdev;
 	security_inode_getsecid(inode, &name->osid);
-	audit_copy_fcaps(name, dentry);
 }
 
 /**
@@ -2232,7 +2231,8 @@ out:
 		n->type = AUDIT_TYPE_NORMAL;
 	}
 	handle_path(dentry);
-	audit_copy_inode(n, dentry, inode);
+	audit_copy_inode(n, inode);
+	audit_copy_fcaps(n, dentry);
 }
 
 /**
@@ -2301,7 +2301,7 @@ void __audit_inode_child(const struct inode *parent,
 		n = audit_alloc_name(context, AUDIT_TYPE_PARENT);
 		if (!n)
 			return;
-		audit_copy_inode(n, NULL, parent);
+		audit_copy_inode(n, parent);
 	}
 
 	if (!found_child) {
@@ -2319,10 +2319,13 @@ void __audit_inode_child(const struct inode *parent,
 			found_child->name_put = false;
 		}
 	}
-	if (inode)
-		audit_copy_inode(found_child, dentry, inode);
-	else
+
+	if (inode) {
+		audit_copy_inode(found_child, inode);
+		audit_copy_fcaps(found_child, dentry);
+	} else {
 		found_child->ino = (unsigned long)-1;
+	}
 }
 EXPORT_SYMBOL_GPL(__audit_inode_child);
 
-- 
1.7.11.7


  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 ` Jeff Layton [this message]
2012-10-26 15:43 ` [PATCH 2/3] audit: break the setup of the audit_name out of audit_inode and into separate function Jeff Layton
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-2-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).