[PATCH v7 02/49] audit: pass in dentry to audit_copy_inode wherever possible

Christoph Hellwig hch at infradead.org
Tue Oct 2 15:53:38 UTC 2012


On Mon, Oct 01, 2012 at 08:16:11PM -0400, Jeff Layton wrote:
> In some cases, we were passing in NULL even when we have a dentry.
> 
> Reported-by: Eric Paris <eparis at redhat.com>
> Signed-off-by: Jeff Layton <jlayton at redhat.com>
> ---
>  kernel/auditsc.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/auditsc.c b/kernel/auditsc.c
> index 4b96415..5c45b9b 100644
> --- a/kernel/auditsc.c
> +++ b/kernel/auditsc.c
> @@ -2226,7 +2226,7 @@ void __audit_inode_child(const struct dentry *dentry,
>  		if (!strcmp(dname, n->name) ||
>  		     !audit_compare_dname_path(dname, n->name, &dirlen)) {
>  			if (inode)
> -				audit_copy_inode(n, NULL, inode);
> +				audit_copy_inode(n, dentry, inode);

Btw, the calling conventions here also seems fairly ugly.

Instead of the optional dentry parameter I'd have a audit_copy_inode
that takes just the name and the inode, and an optional direct  call
to audit_copy_fcaps for those callers that have a dentry.  That would
also allow removing the branch for the dentry == NULL case in
audit_copy_fcaps.




More information about the Linux-audit mailing list