[RFC][PATCH] (#6 U1) the latest incarnation

Timothy R. Chavez tinytim at us.ibm.com
Thu Mar 24 22:02:48 UTC 2005


On Thursday 24 March 2005 10:28 am, Stephen Smalley wrote:
> On Wed, 2005-03-23 at 14:22 -0600, Timothy R. Chavez wrote:
> > This is the latest patch.
>
> Other comments:
>
> - As it stands with your patch, alloc_inode() will leak memory if
> audit_inode_alloc() succeeds but security_inode_alloc() fails because
> nothing frees the audit data on the error handling path for that case.

I took your advice on just initializing inode->i_audit to NULL like the 
security field.  So would this be reasonable Stephen?

if (audit_inode_free(inode) || security_inode_alloc(inode)) {
	audit_inode_free(inode);
	security_inode_free(inode);
	if (inode->i_sb->s_op->destroy_inode)
		inode->i_sb->s_op->destroy_inode(inode);
	else
		kmem_cache_free(inode_cachep, (inode));
	return NULL;
}

This way, in either case where there could be leakage, we clean up the memory 
before the inode goes bye-bye.

-tim




More information about the Linux-audit mailing list