Messages in this thread | | | Date | Sat, 9 Aug 2008 14:53:40 -0400 | From | Christoph Hellwig <> | 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.
| |