[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080809185340.GC22905@infradead.org>
Date: Sat, 9 Aug 2008 14:53:40 -0400
From: Christoph Hellwig <hch@...radead.org>
To: Mimi Zohar <zohar@...ux.vnet.ibm.com>
Cc: linux-kernel@...r.kernel.org,
linux-security-module@...r.kernel.org,
Al Viro <viro@...IV.linux.org.uk>,
Stephen Smalley <sds@...ho.nsa.gov>,
James Morris <jmorris@...ei.org>,
Randy Dunlap <randy.dunlap@...cle.com>, safford@...son.ibm.com,
serue@...ux.vnet.ibm.com, sailer@...son.ibm.com, zohar@...ibm.com
Subject: Re: [PATCH 3/4] integrity: Linux Integrity Module(LIM)
> + if (integrity_inode_alloc(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;
> + }
> +
Please factor this and the lsm failure case out into a single
out_free_inode goto label.
> int vfs_permission(struct nameidata *nd, int mask)
> {
> - return inode_permission(nd->path.dentry->d_inode, mask);
> + int retval;
> +
> + retval = inode_permission(nd->path.dentry->d_inode, mask);
> + if (retval)
> + return retval;
> + return integrity_inode_permission(NULL, &nd->path,
> + mask & (MAY_READ | MAY_WRITE |
> + MAY_EXEC));
> }
>
> /**
> @@ -306,7 +314,14 @@ int vfs_permission(struct nameidata *nd,
> */
> int file_permission(struct file *file, int mask)
> {
> - return inode_permission(file->f_path.dentry->d_inode, mask);
> + int retval;
> +
> + retval = inode_permission(file->f_path.dentry->d_inode, mask);
> + if (retval)
> + return retval;
> + return integrity_inode_permission(file, NULL,
> + mask & (MAY_READ | MAY_WRITE |
> + MAY_EXEC));
Please put your hook into inode_permission. Note that in inode
permission and lots of callers there is no path available so don't pass
it. Please pass the full MAY_FOO mask for new interfaces and do
filtering that won't break if new ones are introduced.
> +#ifdef CONFIG_INTEGRITY
> + void *i_integrity;
> +#endif
Sorry, but I don't think we can bloat the inode even further for this.
> +/*
> + * integrity.h
don't bother to mention the filename in the top of file comment.
--
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